Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Sheet Listing



Hi There,

Looking for VBA that will put into a new sheet a listing of all sheets
in the current book...

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Sheet Listing

Sub ListSheets()
Dim i As Long

On Error Resume Next
Worksheets.Add.Name = "Sheet List"
On Error GoTo 0
Worksheets("Sheet List").Cells.ClearContents
For i = 1 To ActiveWorkbook.Worksheets.Count
Cells(i, "A").Value = Worksheets(i).Name
Next i
Columns(1).AutoFit

End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Darin Kramer" wrote in message
...


Hi There,

Looking for VBA that will put into a new sheet a listing of all sheets
in the current book...

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Sheet Listing

Option Explicit

Sub GetSheets()

Dim ws As Worksheet
Dim wsResult As Worksheet

Set wsResult = Worksheets.Add
wsResult.Name = "Result"
wsResult.Range("A1") = "Sheets"
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Result" Then
wsResult.Range("A65000").End(xlUp).Offset(1) = ws.Name
End If
Next
End Sub


"Darin Kramer" wrote:



Hi There,

Looking for VBA that will put into a new sheet a listing of all sheets
in the current book...

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Sheet Listing

Hi Darin,

Try this. Change "ThisWorkbook" to "ActiveWorkbook" if the code is not
going to be placed in the workbook you want the results in.

Sub ListWorksheetNames()
Dim wksTarget As Worksheet

'Change worksheet name to desired target sheet
Set wksTarget = ThisWorkbook.Worksheets("Sheet1")
For x = 1 To ThisWorkbook.Worksheets.Count
'Change Cells reference (Row, Column) to desired target cells
wksTarget.Cells(x, 1).Value = ThisWorkbook.Worksheets(x).Name
Next x
End Sub

Best regards

John



"Darin Kramer" wrote in message
...


Hi There,

Looking for VBA that will put into a new sheet a listing of all sheets
in the current book...

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet Listing


This works great - however, I have a similar problem, but I have a
worksheet with multiple graphs in it.

Can the code be amended so that it will also list the graph names,
Thanks very much
Hywel


--
Hywel
------------------------------------------------------------------------
Hywel's Profile: http://www.excelforum.com/member.php...o&userid=14824
View this thread: http://www.excelforum.com/showthread...hreadid=476738

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
Ranking Question Listing Same Sheet! Killer Excel Discussion (Misc queries) 3 June 7th 07 02:12 AM
pulling data from one sheet and listing selected data in another Bfly Excel Worksheet Functions 2 February 2nd 07 01:38 AM
Listing of Sheet names Will Fleenor Excel Worksheet Functions 1 November 17th 04 05:19 PM
listing sheet tabs John Excel Programming 2 July 23rd 04 03:51 AM
Listing External Worksheet references to your sheet Dave Bash Excel Programming 0 January 7th 04 06:19 PM


All times are GMT +1. The time now is 10:42 AM.

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

About Us

"It's about Microsoft Excel"