I have an Excel document with two different Sheets. Sheet 1 has many columns with header names and blank rows. Sheet 2 has some of these columns with exact header names and an entry in the 2nd Row.
I want to make a macro that will look through all the column headers in Sheet 2 and find their corresponding match in Sheet1. When the match is found, I need to copy the entry in Row 2 of the Sheet2 header into the matching header of sheet1. Some entries in Sheet1 will not have matches and will remain blank.
My 2 sheets currently:
Sheet1
apple | orange | mango | grape | banana
------------------------------------------
[BLANK] |[BLANK] |[BLANK] |[BLANK] | [BLANK]
Sheet2
orange | mango | banana
--------------------------
yumm | yuck | maybe
What I want after Macro is run:
Sheet1
apple | orange | mango | grape | banana
------------------------------------------
[BLANK] |yumm |yuck |[BLANK] | maybe
I am learning VBA, about 2 weeks in. I am having trouble with getting my program to do this. I have seen similar questions but they usually match one item in one column only not multiple names in multiple columns. The codes I have tried have not done anything like what I need.
Also, This has to be done as a macro or function since the program will be sent to a user that needs this to be already done automatically. I think that doing VLOOKUP would not work here since I will not know the number of columns in either sheet until the user enters them in which case the program will automatically populate the row 2 of the matching ones. Any ideas?