Macro to Print all worksheets in workbook
Sub AllWorkSheets()
' Coded on 12/10/2006 at 12:45 AM
' Coded by Jason Lepack
'
' Loops through all worksheets and lists their names in a new worksheet
'
Dim wsNew As Worksheet, wsTemp As Worksheet
Dim r As Range
Set wsNew = Sheets.Add ' add a new worksheet
wsNew.Name = "All_Sheets" ' named "All_Sheets"
Set r = wsNew.Range("A1") ' cell to place the name in
For Each ws In ActiveWorkbook.Sheets 'loop through all worksheets
r = ws.Name ' put the name of the worksheet in the new sheet
Set r = r.Offset(1, 0) ' move down one cell
Next ws
' clean up
Set ws = Nothing
Set r = Nothing
Set wsNew = Nothing
End Sub
Cheers,
Jason Lepack
Dean wrote:
Can someone give me macro to print all worksheets in a workbook? Thank you.
Dean
|