+ Reply to Thread
Results 1 to 4 of 4

Find Value and Copy/Paste Row from One Worksheet to Another

  1. #1
    Registered User
    Join Date
    06-23-2008
    Posts
    14

    Find Value and Copy/Paste Row from One Worksheet to Another

    Hi,

    I'm somewhat familiar with the vlookup function and how it works, but not advanced enough to integrate it the way I would like.

    I have 2 worksheets with multi-column ranges. I would like to use vba to search a single column (A) in Sheet1 for a value in column (B) of Sheet 2. Then, I want to copy the row in which column (A) of Sheet 1 exists to the same row column (B) exists of Sheet2.

    So, if Sheet1 looks like:

    A B C
    1 1 3
    2 1 3
    3 1 3

    And Sheet2 looks like:

    A B C
    1 1 3
    1 2 3
    1 3 3

    Then the Copy/Paste goes to Sheet2 to look like:
    A B C D E F
    1 1 3 1 1 3
    1 2 3 2 1 3
    1 3 3 3 1 3

    I hope that makes sense.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    You don't actually need VBA to achieve this.

    Enter the following on Sheet 2 and copy down. Change the range row refs as appropriate

    D1: =VLOOKUP($B1,Sheet1!$A$1:$C$3,1,FALSE)
    E1: =VLOOKUP($B1,Sheet1!$A$1:$C$3,2,FALSE)
    F1: =VLOOKUP($B1,Sheet1!$A$1:$C$3,3,FALSE)

    Rgds

  3. #3
    Registered User
    Join Date
    06-23-2008
    Posts
    14
    Thanks,

    I'll give this a shot when I get to work. I'd still like to use vba so that I can put it in a macro, but I'll play with macro recorder for that.

    Thanks Again.

  4. #4
    Registered User
    Join Date
    06-23-2008
    Posts
    14
    I wanted to edit my last post but I couldn't find it. The find function seems to work much better for me now, but I'm having trouble incorporating it into a loop. Any help is always appreicated:

    Please Login or Register  to view this content.
    I'm trying to Count C for the number of rows that are in my range.

    Sorry for the confusion.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1