PDA

View Full Version : Loop thru range, find and copy data to matching sheets



francis
05-25-2008, 10:51 AM
Hi

I have a worksheet which in col C are names and the names can
be repetitive.eg ABC CR Fund A can be in C3, C12. But each row data
are different.

The folders prenamed in the first 3-5, eg ABC or STATE
There many xls workbook templates named the same as the folders' names
In these workbooks, there are many sheets named as the same as values
in col C. Each unqiue name is in each sheet.


I need a macro to

1) loop thru col C until last row, get to the correct folder and open the workbook which reside in the folder. eg C:/process/ABC folder/ABC.xls workbook name

2) using the value in col C, eg ABC CR Fund A is the value in col C2 and find the matching sheet template's name eg ABC CR Fund A and copy some data to certain cells of the sheet template and save it for printing after the whole process. Then move one cell down and repeat the same

The part which is daunting me is that if the next cell is having the same value as the above cell, and this can go on for the next few cells down,
I need to copy/add the previously used sheet template and copy the
certain data from the row to the new copied/added template:banghead:

In the sample xls workbook templates, the highlighted cells are variables according to the matching names in col C of the Utility workbook

TIA for all help

regards, francis

francis
05-26-2008, 09:46 AM
I am cross posting here http://www.mrexcel.com/forum/showthread.php?p=1578779#post1578779 in the hope of receiving a response as there was no response from this forum

regards, francis