Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Clif
 
Posts: n/a
Default How do I print a list of worksheet tab names in a workbook

I can view a list of the worksheet tabs using the properties command and
viewing the contents tab, however sometimes I need to print a list of the tab
names. To do this I use the Print Screen. This is slow and must be done
several times to include all the tab names. Is there a way of printing this
list any faster?
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

Try a macro like this:

Sub PrintWSNames()
Dim sh As Worksheet
Dim i As Long

With ActiveWorkbook
.Worksheets(1).Select
Set sh = .Worksheets.Add
End With

With sh
For i = 2 To ActiveWorkbook.Worksheets.Count
.Cells(i, "A").Value = Worksheets(i).Name
Next i
.Cells(1, "A").Value = "Sheet " & _
"Names (excl. this one)"

[A:A].EntireColumn.AutoFit

.PrintOut Copies:=1, Collate:=True
End With

End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
I can view a list of the worksheet tabs using the

properties command and
viewing the contents tab, however sometimes I need to

print a list of the tab
names. To do this I use the Print Screen. This is slow

and must be done
several times to include all the tab names. Is there a

way of printing this
list any faster?
.

  #3   Report Post  
JohnL
 
Posts: n/a
Default

Jason, I like your macro and succesfully "ran" it. How can I
adjust it to list the tabs which have charts? I tried to replace
"Worksheets" with "Charts" but ran into an error at ".Cells"

Sub PrintCHNames()
Dim ch As Chart
Dim i As Long

With ActiveWorkbook
.Charts(1).Select
Set ch = .Charts.Add
End With

With ch
For i = 2 To ActiveWorkbook.Charts.Count
.Cells(i, "A").Value = Charts(i).Name
Next i
.Cells(1, "A").Value = "Sheet " & "Names (excl. this one)"

[A:A].EntireColumn.AutoFit

..PrintOut Copies:=1, Collate:=True

End With
End Sub

Thanks in advance, Jason

"Jason Morin" wrote:

Try a macro like this:

Sub PrintWSNames()
Dim sh As Worksheet
Dim i As Long

With ActiveWorkbook
.Worksheets(1).Select
Set sh = .Worksheets.Add
End With

With sh
For i = 2 To ActiveWorkbook.Worksheets.Count
.Cells(i, "A").Value = Worksheets(i).Name
Next i
.Cells(1, "A").Value = "Sheet " & _
"Names (excl. this one)"

[A:A].EntireColumn.AutoFit

.PrintOut Copies:=1, Collate:=True
End With

End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
I can view a list of the worksheet tabs using the

properties command and
viewing the contents tab, however sometimes I need to

print a list of the tab
names. To do this I use the Print Screen. This is slow

and must be done
several times to include all the tab names. Is there a

way of printing this
list any faster?
.


  #4   Report Post  
Gord Dibben
 
Posts: n/a
Default

John

Try this variation to get both worksheets and chart sheets listed.

Private Sub ListSheets()
'list of sheet names starting at A1
Dim Rng As Range
Dim i As Integer
Worksheets.Add
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub

See VBE Help under "Sheets Collection Object"


Gord Dibben Excel MVP



On Wed, 2 Mar 2005 11:31:09 -0800, "JohnL"
wrote:

Jason, I like your macro and succesfully "ran" it. How can I
adjust it to list the tabs which have charts? I tried to replace
"Worksheets" with "Charts" but ran into an error at ".Cells"

Sub PrintCHNames()
Dim ch As Chart
Dim i As Long

With ActiveWorkbook
.Charts(1).Select
Set ch = .Charts.Add
End With

With ch
For i = 2 To ActiveWorkbook.Charts.Count
.Cells(i, "A").Value = Charts(i).Name
Next i
.Cells(1, "A").Value = "Sheet " & "Names (excl. this one)"

[A:A].EntireColumn.AutoFit

.PrintOut Copies:=1, Collate:=True

End With
End Sub

Thanks in advance, Jason

"Jason Morin" wrote:

Try a macro like this:

Sub PrintWSNames()
Dim sh As Worksheet
Dim i As Long

With ActiveWorkbook
.Worksheets(1).Select
Set sh = .Worksheets.Add
End With

With sh
For i = 2 To ActiveWorkbook.Worksheets.Count
.Cells(i, "A").Value = Worksheets(i).Name
Next i
.Cells(1, "A").Value = "Sheet " & _
"Names (excl. this one)"

[A:A].EntireColumn.AutoFit

.PrintOut Copies:=1, Collate:=True
End With

End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
I can view a list of the worksheet tabs using the

properties command and
viewing the contents tab, however sometimes I need to

print a list of the tab
names. To do this I use the Print Screen. This is slow

and must be done
several times to include all the tab names. Is there a

way of printing this
list any faster?
.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I count distinct names in an excel list? RPC@Frito Excel Discussion (Misc queries) 5 February 3rd 05 09:12 PM
Pull unique names for drop down list [email protected] Excel Discussion (Misc queries) 3 February 1st 05 10:23 PM
Can one print a list of worksheet tab labels contained in a workb. Kelroy D B Excel Discussion (Misc queries) 1 January 27th 05 07:03 PM
List box not being displayed in second worksheet Brian Excel Discussion (Misc queries) 2 January 27th 05 04:35 PM
List on different worksheet bevpike Excel Discussion (Misc queries) 3 January 25th 05 10:39 PM


All times are GMT +1. The time now is 07:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"