I have two excel workbooks that I am trying to read from. I need to read from a column in the first one, and compare that field to a field in the second workbook. If there is a match, I want to copy the original row to a new excel workbook, and append the name with a piece of another column. Furthermore, if another column in that row is filled, I need to duplicate the original row again into the new workbook, and append that name. That will happen up to 20 times per row, but not always.
Basically, I need to do something like this:
Workbook A:
Name OtherData1 OtherData2
-------- ---------- ----------
Railroad Data Data
MailRoute Data Data
BoatPath Data Data
Workbook B:
Name rtuTopic[1] rtuTopic[2] [.....] rtuTopic[20]
-------- -------- -------- --------
Railroad Route_01 Route_05 Route_21
MailRoute Route_12 NULL NULL
BoatPath Route_01 Route_15 NULL
Workbook C (the result I want)
Name OtherData1 OtherData2 rtuTopic
-------- ---------- ---------- --------
Railroad_01 Data Data Route_01
Railroad_05 Data Data Route_05
...........
Railroad_21 Data Data Route_21
MailRoute_12 Data Data Route_12
BoatPath_01 Data Data Route_01
BoatPath_15 Data Data Route_15
The columns I need to append are not conveniently next to one another. They are separated by 5 or 6 other columns, give or take, and I don't know where to get started. I searched around and saw how to copy entire sheets from one workbook to another, but I didn't see how to really specifically dig down and duplicate a row the way I need to.