Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sheets in workbook are A, B, C, D, E, F, G plus the two that are excluded in the code.
Total combined rows with data for all A to G sheets is about 52. (about 7 per sheet.) If I run SheetsCopy1 I get about 5000 rows copied to Summary sheet, multiple repeats of correct data. If I run SheetsCopy2 I see each sheet range to copy is properly selected and the Msgbox shows the correct sheet name. The DeBug.Print lists the proper sheets A to G. Code is in a standard module, and the downloaded example workbook looks to be German, saved as ...xlsm. What little tid-bit am I overlooking here? Thanks, Howard Sub SheetsCopy1() Dim ws As Worksheet Dim Rng As Range For Each ws In ThisWorkbook.Sheets If (ws.Name < "Summary") And (ws.Name < "Begin blad") Then With ws ws.Activate Set Rng = Range("A2", Range("D2").End(xlDown)) Rng.Copy Sheets("Summary").Range("A" & Rows.Count).End(xlUp)(2) End With End If Next End Sub Sub SheetsCopy2() Dim ws As Worksheet Dim Rng As Range Dim lRow As Long For Each ws In ThisWorkbook.Sheets If (ws.Name < "Summary") And (ws.Name < "Begin blad") Then 'Debug.Print ws.Name With ws ws.Activate Set Rng = Range("A2", Range("D2").End(xlDown)) Rng.Select MsgBox ws.Name End With End If Next End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Update Cell in WKBook 1 From WkBook 2 | Excel Discussion (Misc queries) | |||
VBA Open Wkbook Disabling Macros | Excel Programming | |||
How to link to a single wksheet in a wkbook that has comments | Excel Discussion (Misc queries) | |||
[hlp]: How to copy a sheet to new wkbook and close the var at the end | Excel Programming | |||
Can changes to a worksheet be applied to all wksheets in wkbook? | Excel Worksheet Functions |