+ Reply to Thread
Results 1 to 4 of 4

Match on Rows and Columns &Copy/Paste-VBA code

  1. #1
    Registered User
    Join Date
    04-04-2012
    Location
    Tucker, Georgia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Match on Rows and Columns &Copy/Paste-VBA code

    Upload values based on matching Rows and Columns***I am using 2 worksheets-trying to write a two way lookup logic in VBA.. Currently I am using a Vlookup to match
    1st worksheet is the template= called the “template”
    2nd worksheet contains the data= data
    Objective- Copy data from worksheet 2, where values are the same in the worksheet 1(template), must match on rows and column headers…
    If there is no match, insert the value of “0”in Worksheet 1
    If there is a matching value, copy the “$ value” from worksheet 2 (data) and paste it in worksheet 1(template)
    Hence, I am copying data from worksheet 2 (data) and pasting the data in worksheet 1
    Here is the VBA code that I have so far…Please help
    Sub vbVlookup()
    Range("A3").Formula = "=vlookup(A3,'!Data'!$A$3:$I$16,match(B3,$B$2:I$2$,0)+1,False)"
    Range("A3").Value = Range("A3").Value
    Range("B3").Value = Range("B3").Value
    Attached Files Attached Files

  2. #2
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: Match on Rows and Columns &Copy/Paste-VBA code

    Hi npitts,

    I attempted this with formula's... Let me know if this worked.



    If I was able to help – PLEASE DO NOT FORGET to Click the small star icon at the bottom left of my post.
    Thanks,

    Bonny Tycoon


  3. #3
    Registered User
    Join Date
    04-04-2012
    Location
    Tucker, Georgia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Match on Rows and Columns &Copy/Paste-VBA code

    When I try to run it in another workbook, its not updating... Do i need to recordi it first? I am new to this...

  4. #4
    Registered User
    Join Date
    04-04-2012
    Location
    Tucker, Georgia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Match on Rows and Columns &Copy/Paste-VBA code

    BTW-Thanks for the code-it is working perfectly!! I just cant get it to run in another workbook... Do you know why?

+ 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