+ Reply to Thread
Results 1 to 4 of 4

VBA code to copy column data only if headers match

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    88

    VBA code to copy column data only if headers match

    Hi everyone, need help to create a code that will copy from one range to another, only if header matches.

    Ive attached a sample as well here:sampleA.xlsx

    In the sample I have, 2 sets of data in a sheet, the top one is incomplete, the bottom one is.

    What I want the macro to do is to copy all data under the header from the bottom set when the header matches the header in the top set, and loop end of top data header. Copied data is pasted under the matching header of the top data set.

    Thanks in advance.

  2. #2
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: VBA code to copy column data only if headers match

    You could try
    Please Login or Register  to view this content.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  3. #3
    Registered User
    Join Date
    04-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: VBA code to copy column data only if headers match

    Thanks Smuzoen, it works perfectly for my sample, could I ask a liitle more help please?

    I've attached an edited sample that more closely resembles my project here sample3.xlsx.

    The incomplete set and complete set are now in different sheets and different rows, could you please edit the code so that it works for the edited sample.

    If it is not too much, could I also ask you to put comments where I have to change the code when I move the sets around please.

    Thanks a lot.

  4. #4
    Registered User
    Join Date
    04-05-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: VBA code to copy column data only if headers match

    Scratch that request, ive figured it out already.

    Thank you very much Anthony.

+ 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