Macro to C&P from all Sheets

R

Robert Farrand

I need a Macro to select the same specific cells on every sheet in
workbook and fill in the first master tab to with the info. Basical
each tab is an employee, and it will have there total wage, so th
specific cells will copy the name (B2) and the total wage(G23).

The other issue is there is about 100 tabs, and they are constantl
changing, adding and deleting, so the macro needs to adapt to ne
sheets?

Any ideas
 
J

joeu2004

Robert Farrand said:
I need a Macro to select the same specific cells on every
sheet in a workbook and fill in the first master tab to
with the info. Basicaly each tab is an employee, and it
will have there total wage, so the specific cells will
copy the name (B2) and the total wage(G23).
The other issue is there is about 100 tabs, and they are
constantly changing, adding and deleting, so the macro
needs to adapt to new sheets?

If the "master tab" is always the first worksheet and all of the remaining
worksheets are to be copied, perhaps the following get you started.

Dim mastRng As Range
Dim i As Long, n As Long
' copy into A2:B2, A3:B3, etc
Set mastRng = Sheets(1).Range("A2")
For i = 2 to Sheets.Count
mastRng.Offset(i-2,0) = Sheets(i).Range("B2")
mastRng.Offset(i-2,1) = Sheets(i).Range("G23")
Next
 

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