Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / November 2006

Tip: Looking for answers? Try searching our database.

List all sheets present in Workbook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JEFF - 09 Nov 2006 17:26 GMT
Hello,

Looking for some code that will return the names of all worksheets present
in the workbook.  The number of sheets and their names change...

Help?!
Gary''s Student - 09 Nov 2006 17:39 GMT
Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
   MsgBox (w.Name)
Next
End Sub
Signature

Gary's Student

> Hello,
>
> Looking for some code that will return the names of all worksheets present
> in the workbook.  The number of sheets and their names change...
>
> Help?!
JEFF - 09 Nov 2006 18:47 GMT
Sorry....   Looking for it to list them in a column within Sheet 1, starting
in A1

> Sub allsheet()
> Dim w As Worksheet
[quoted text clipped - 9 lines]
> >
> > Help?!
Gord Dibben - 09 Nov 2006 20:48 GMT
Jeff

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

Gord Dibben  MS Excel MVP

>Sorry....   Looking for it to list them in a column within Sheet 1, starting
>in A1
[quoted text clipped - 12 lines]
>> >
>> > Help?!
JEFF - 09 Nov 2006 21:03 GMT
Perfect.... thank you

> Jeff
>
[quoted text clipped - 27 lines]
> >> >
> >> > Help?!
Gary''s Student - 09 Nov 2006 20:52 GMT
No problem:

Sub allsheet()
Dim w As Worksheet
i = 1
For Each w In ActiveWorkbook.Worksheets
   Sheets("Sheet1").Cells(i, "A").Value = w.Name
   i = i + 1
Next
End Sub
Signature

Gary's Student

> Sorry....   Looking for it to list them in a column within Sheet 1, starting
> in A1
[quoted text clipped - 12 lines]
> > >
> > > Help?!
JEFF - 09 Nov 2006 21:03 GMT
that works... thanks!

> No problem:
>
[quoted text clipped - 23 lines]
> > > >
> > > > Help?!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.