View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
confused confused is offline
external usenet poster
 
Posts: 193
Default Looping through Worksheets to create Summary Page


Thanks. Can you tell me what "DLR" and "SLR" mean in the code you wrote?
I'm trying to understand the code and learn from this.



"Don Guillett" wrote:

If sh.Name < "Consolidated" and _
sh.Name < "othersheetname" Then

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Confused" wrote in message
...
Thanks Don. That works perfectly.
What if I need to exclude one worksheet from the summary page?

"Don Guillett" wrote:

Here is one I did earlier today

Option Private Module
Sub consolidatesheetsSAS() 'SalesAid Software
Application.ScreenUpdating = False

With Sheets("consolidated")
..Rows("2:" & Cells(2, 1).End(xlDown).Row).Delete

For Each sh In ActiveWorkbook.Sheets

If sh.Name < "Consolidated" Then
dlr = .Cells(Rows.Count, 1).End(xlUp).Row + 1
slr = sh.Cells(Rows.Count, 1).End(xlUp).Row
If slr 1 Then sh.Cells(3, 1).Resize(slr, 12).Copy .Cells(dlr, 1)
End If

Next sh

..Columns("A:L").HorizontalAlignment = xlCenter
End With

Application.ScreenUpdating = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Confused" wrote in message
...
I have a workbook with about 20 worksheets. The worksheets contain the
same
column names. I would like a macro that would create a summary page
based
on
the 20 worksheets.

Can anyone help me?