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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,262
Messages
6,118,551
Members
448,835
Latest member
Profast123

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