copying data from multiple worksheets

gregh

New Member
Joined
Nov 10, 2005
Messages
7
Hi,
I have a file that has many (approx 100) worksheets. On each of these sheets, there are five cells of data in cells A100-E100. I would like to extract this data from each sheet and put it in one sheet with 100 rows. I have been trying to write a macro that would loop through each sheet, but no luck so far.

Any suggestions?

Thanks
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,343
Office Version
  1. 365
Platform
  1. Windows
Perhaps something like this.
Code:
Dim wsNew As Worksheet
Dim ws As Worksheet
Dim I As Long

Set wsNew = Worksheets.Add
I=1
For Each ws In Worksheets
     If ws.Name<>wsNew.Name Then 

         ws.Range("A100:E100").Copy wsNew.Range("A" & I)
         I=I+1
     End If
Next ws
 

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
Try:

Code:
Sub test()
Dim ws As Worksheet, i As Long

i = 1
For Each ws In ThisWorkbook.Worksheets
    'Replace "Extracted Data with the name of the sheet _
    the results will be copied to
    
    If ws.Name <> "Extracted Data" Then
        ws.Range("A100:E100").Copy Destination:= _
        Sheets("Extracted Data").Cells(i, "A")
        i = i + 1
    End If
Next ws

End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,809
Messages
5,833,790
Members
430,233
Latest member
cbutts

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
Top