+ Reply to Thread
Results 1 to 10 of 10

Need a macro code for matching a data and copying multiple columns

  1. #1
    Registered User
    Join Date
    05-02-2013
    Location
    Jersey City
    MS-Off Ver
    Excel 2010
    Posts
    7

    Need a macro code for matching a data and copying multiple columns

    Hi,

    I have two tables :-


    Table 1 :
    --------------------------------------

    Col 1 Col 2 Col 3

    aaa
    ccc
    jjj



    Table 2 :
    -------------------------------------------

    Col 1 Col 2 Col 3

    aaa 1 2
    bbb 3 4
    ccc 5 6
    ddd 7 8
    eee 9 10
    fff 11 12
    ggg 13 14
    hhh 15 16
    iii 17 18
    jjj 19 20

    Now, i want to write a code which will search each entry present in Table 1 : Col 1 in Table 2: Col 1 and when a match is found, populate Table 1: Col2 with Table2:Col2 and Table 1:Col3 with Table 2: Col 3



    Final output i am looking for would be :-

    Table 1

    -------------------------------------------

    Col 1 Col 2 Col 3

    aaa 1 2
    ccc 5 6
    jjj 19 20

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro code for matching a data and copying multiple columns

    Please attach a sample workbook with a desired result. To attach a sample, go to advance then attachment.

  3. #3
    Registered User
    Join Date
    05-02-2013
    Location
    Jersey City
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Need a macro code for matching a data and copying multiple columns

    uploaded the file. thanks..the columns highlighted in yellow is the output i desire

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro code for matching a data and copying multiple columns

    Try the attached.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-02-2013
    Location
    Jersey City
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Need a macro code for matching a data and copying multiple columns

    thanks a ton, works fine for the number of columns that i mentioned.

    is there anyway i can modify the script so as to accomodate more columns in the future if the requirement changes.

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro code for matching a data and copying multiple columns

    Well, you can if you can. If not, send me a PM and will adjust for you.
    For now please close the thread as solved.

  7. #7
    Registered User
    Join Date
    05-02-2013
    Location
    Jersey City
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Need a macro code for matching a data and copying multiple columns

    attaching the actual file from my workspace.

    i need to match ColE in Software Analysis sheet with ColA in MasterList sheet and populate ColF-ColJ in SoftwareAnalysis sheet with ColB-ColF of MasterList sheet if a match is found.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro code for matching a data and copying multiple columns

    Try Attached.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-02-2013
    Location
    Jersey City
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Need a macro code for matching a data and copying multiple columns

    Wow, this works great. You rock !!

    Thanks a ton again.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need a macro code for matching a data and copying multiple columns

    Faiz,
    You are welcome!

+ 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