1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Copying cells based on Criteria in VBA

Discussion in 'Business Applications' started by Tomo1991, Jan 14, 2013.

Thread Status:
Not open for further replies.
  1. Tomo1991

    Tomo1991 Thread Starter

    Joined:
    Jan 13, 2013
    Messages:
    4
    Hi All,

    Very new to this but have a look at the attachment and see if you can help.

    I've used the code

    Sub Loading2()
    Dim LastRow As Integer

    LastRow = Worksheets("Table").Range("A65536").End(xlUp).Row

    Sheets("Input").Range("B5,D5,F5,H5,J5,L5,N5").Copy Sheets("Table").Range("A" & LastRow + 1)
    Sheets("Input").Range("B5,D5,F5,H5,J5,L5,N5").ClearContents

    End Sub
    Sub Supplying()

    Dim LastRow As Integer

    LastRow = Worksheets("Table").Range("A65536").End(xlUp).Row

    Sheets("Input").Range("B5,D5,F5,H5,J5,L5,N5").Copy Sheets("Table").Range("A" & LastRow + 1)
    Sheets("Table").Range("D" & LastRow + 1).Copy Sheets("Table").Range("H" & LastRow + 1)
    Sheets("Table").Range("E" & LastRow + 1).Copy Sheets("Table").Range("I" & LastRow + 1)
    Sheets("Table").Range("F" & LastRow + 1).Copy Sheets("Table").Range("J" & LastRow + 1)
    Sheets("Table").Range("G" & LastRow + 1).Copy Sheets("Table").Range("K" & LastRow + 1)
    Sheets("Input").Range("B5,D5,F5,H5,J5,L5").ClearContents
    Sheets("Table").Range("D" & LastRow + 1).ClearContents
    Sheets("Table").Range("E" & LastRow + 1).ClearContents
    Sheets("Table").Range("F" & LastRow + 1).ClearContents
    Sheets("Table").Range("G" & LastRow + 1).ClearContents

    End Sub


    But basically I need to paste inputs into different sheets depending on the vessel used e.g. Titanic in the sheet Titanic and President in the sheet president.

    Can anyone help???
     

    Attached Files:

  2. CDHarm

    CDHarm

    Joined:
    May 26, 2011
    Messages:
    255
    HI,

    You attached a workbook but I do not see an example as to your request.
    Please provide an example a before and after code.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1085243

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice