ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   List all sheets present in Workbook (https://www.excelbanter.com/excel-worksheet-functions/118189-list-all-sheets-present-workbook.html)

Jeff

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

Gary''s Student

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


Jeff

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


Gord Dibben

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



Gary''s Student

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


Jeff

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


Jeff

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





All times are GMT +1. The time now is 06:15 AM.

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