Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 921
Default List all sheets present in Workbook

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?!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default List all sheets present in Workbook

Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
MsgBox (w.Name)
Next
End Sub
--
Gary's Student


"JEFF" wrote:

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?!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 921
Default List all sheets present in Workbook

Sorry.... Looking for it to list them in a column within Sheet 1, starting
in A1

"Gary''s Student" wrote:

Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
MsgBox (w.Name)
Next
End Sub
--
Gary's Student


"JEFF" wrote:

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?!

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default List all sheets present in Workbook

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

On Thu, 9 Nov 2006 10:47:02 -0800, JEFF wrote:

Sorry.... Looking for it to list them in a column within Sheet 1, starting
in A1

"Gary''s Student" wrote:

Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
MsgBox (w.Name)
Next
End Sub
--
Gary's Student


"JEFF" wrote:

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?!


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default List all sheets present in Workbook

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
--
Gary's Student


"JEFF" wrote:

Sorry.... Looking for it to list them in a column within Sheet 1, starting
in A1

"Gary''s Student" wrote:

Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
MsgBox (w.Name)
Next
End Sub
--
Gary's Student


"JEFF" wrote:

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?!



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 921
Default List all sheets present in Workbook

that works... thanks!

"Gary''s Student" wrote:

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
--
Gary's Student


"JEFF" wrote:

Sorry.... Looking for it to list them in a column within Sheet 1, starting
in A1

"Gary''s Student" wrote:

Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
MsgBox (w.Name)
Next
End Sub
--
Gary's Student


"JEFF" wrote:

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?!

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 921
Default List all sheets present in Workbook

Perfect.... thank you

"Gord Dibben" wrote:

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

On Thu, 9 Nov 2006 10:47:02 -0800, JEFF wrote:

Sorry.... Looking for it to list them in a column within Sheet 1, starting
in A1

"Gary''s Student" wrote:

Sub allsheet()
Dim w As Worksheet
For Each w In ActiveWorkbook.Worksheets
MsgBox (w.Name)
Next
End Sub
--
Gary's Student


"JEFF" wrote:

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?!



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
Data Validation for list in a different workbook vicky Excel Discussion (Misc queries) 2 November 6th 06 10:25 PM
Creating a List Jeff Bendert Excel Discussion (Misc queries) 4 October 23rd 06 03:35 AM
auto updating list Larry Excel Worksheet Functions 8 July 27th 06 01:59 PM
Getting Sheets Copied From One Workbook to Another Without ....? Mhz New Users to Excel 6 July 18th 06 04:39 AM
Dropdown list connected to another workbook Pieman Excel Worksheet Functions 5 March 12th 06 09:35 PM


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

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"