ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Printing XL Sheets name (https://www.excelbanter.com/excel-discussion-misc-queries/177104-printing-xl-sheets-name.html)

Muhammad Rizwan Khan - XL Sheets Name

Printing XL Sheets name
 
I have many sheets in my EXCEL file (Excel 2000).
How can I print all the sheets name only, not the contents of sheet ?
is there any function or trick ?

Bob Phillips

Printing XL Sheets name
 
Public Sub Test()
Dim ws As Worksheet
Dim newWs As Worksheet
Dim i As Long

Set newWs = Worksheets.Add
For Each ws In ActiveWorkbook.Worksheets

If ws.Name < newWs.Name Then

i = i + 1
newWs.Cells(i, "A").Value = ws.Name
End If
Next ws
newWs.PrintOut
Application.DisplayAlerts = False
newWs.Delete
Application.DisplayAlerts = True

End Sub

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Muhammad Rizwan Khan - XL Sheets Name" <Muhammad Rizwan Khan - XL Sheets
wrote in message
...
I have many sheets in my EXCEL file (Excel 2000).
How can I print all the sheets name only, not the contents of sheet ?
is there any function or trick ?





All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com