VBA copy data within a range of sheets to a summary sheet

andybhoy

New Member
Joined
Mar 28, 2011
Messages
4
Hi,
can anyone help me with the following problem?

I have a file with lots of sheets but I only want to copy some of the sheets to a summary sheet showing each line item that was copied.
I have set up "first sheet" and "last sheet", so I would be looking to copy the same range of data from each sheet ( say A1 to z100) that is located between the first and "last sheet" and ignore all other sheets not between these two.
The do not know the names of the sheets between the sheets "first" and "last", and I do not know how many sheets there is to be copied.
I would like to copy all the info into a summary sheet, but keep putting the info below the previously copied sheet.

Any help or advice would be greatly appreciated.

thanks
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try

Code:
Sub test()
Dim First As Long, Last As Long, i As Long
First = Sheets("First").Index
Last = Sheets("Last").Index
For i = First To Last
    If Sheets(i).Name <> "Summary" Then Sheets(i).Range("A1:Z100").Copy Destination:=Sheets("Summary").Range("A" & Rows.Count).End(xlUp).Offset(1)
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,555
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top