Help with Code: Append multiple Selections

Capt.Ragnar

Board Regular
Joined
Jun 6, 2012
Messages
138
I have a workbook with 219 worksheets. The data I need from each resides in the same range (A53:O57).

I cannot figure out what is wrong with the following code...

<CODE>

Sub SummurizeSheets()
Dim ws As Worksheet

Application.ScreenUpdating = False
Sheets("Summary").Activate

For Each ws In Worksheets
If ws.Name <> "Summary" Then
ws.Range("a53:O57").Copy
Worksheets("Summary").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
End If
Next ws
End Sub

<CODE>
<CODE>

When I run the macro I only get the selection from the last worksheet none from the rest. Me thinks it is pasting over the same area in the "Summary" worksheet, but I cannot tell.

</CODE></CODE></CODE>
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
<code><code><code>When I run the macro I only get the selection from the last worksheet none from the rest. Me thinks it is pasting over the same area in the "Summary" worksheet, but I cannot tell.

</code></code></code>
Comment out the Application.ScreenUpdating line and then step through the code by pressing the F8 button. You can watch what it does on each line to see if it will help you identify what's going wrong.
 
Upvote 0
Yup. That was it.

Issue was the data source had a hidden column "A" with no data in it. So when the code attempted to find last line of data it was going back to the top each time after the paste.

Good call.

Thanks. Occam's razor...
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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