Looping through dynamic ranges from multiple worksheets

T

TechWrangler

Hi,

This is my first post so go easy on me. I am trying to take spreadshee
data from two different sheets. These sheets are generated by a batc
process dumping the data out of a sql server DB. I got the range to b
dynamic and resize each time there is a new dump. This is how I did i
for Range PMA03:

=OFFSET(PMA!$B$2,MATCH("PMA03",PMA!$C:$C,0)-2,0,COUNTIF(PMA!$C:$C,"PMA03"),1)

All of this is entered into the "Refers to:" box of the Name>Defin
interface.
The unusual thing here is that the column is made up of multiple range
(PMA01 - PMA09). Each cell in column B is a string and the range size i
based on the ajoining cell column C which contains the key linking it t
another range on another sheet (CRP or sheet2). This part is workin
good.

The hard part is that I have to take the data string from 'sheet2'!A
and put it into 'sheet1'!B14. Then take the data (cross referenced vi
the adjacent key fields from each sheet (2 & 3)) from 'sheet3'!C2 an
paste it into 'sheet1'!C14. Then copy 'sheet3'!E2 and paste only th
formating into 'sheet1'E14. This formating then needs to be copie
right to all the rest of the cells in the row. Then a new row need
inserted.

I used a macro and I can get the first line of data to work using th
following code. I need help with looping through the rest of the range
and populating sheet1. From what I can gather I will need to have neste
For loops that go through the range on sheet3 then iterate to the nex
row of the range on sheet 2. Then go through the next range on sheet3
etc...

In the end the sheet should look like:
Data1 DataA1 Format Format...
Data1 DataB1 Format Format...
Data2 DataA2 Format Format...
Data2 DataB2 Format Format...
Data2 DataC2 Format Format...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top