how can you let macro determine to where to copy

M

mohavv

Hi,

I've got several sheets with the same info but in a different layout
in columns.
The column headers are identical. The sheets have a different number
of rows.

Can I get a macro te "read" the header and copy that cell value to
another sheet under the corresponding header.

Row by row cell by cell.

Cheers,

Harold

Example of sheet: NAM.xls to be copied to: TOTAL.xls

name sz Trays Loss Nett Trays Gross Price ... ... ...
a 10 100 4 96 576
b 12 110 5 105 630
c 14 150 8 142 852
....
....
....
 
B

Bob Phillips

Use Application.Match to find where it is in the target sheet

ColNum = Application.Match(Range("A1",
Workbooks("Total.xls").Worksheets(1).Rows(1)
Workbooks("Total.xls").Worksheets(1).Cells(2,ColNum).Value =
Range("A2").Value

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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