lists

MAMIBUSSOL

Board Regular
Joined
Jun 2, 2011
Messages
95
Hi

In my workbook I have a series of Sheets

Sheet1 (S JAN 1)
Sheet2 (P JAN 1)
Sheet3 (S FEB 1)
Sheet4 (P FEB 1)

Etc

I want to generate a list of sheetnames from a workbook

any ideas how to accomplish
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this:

Sub SheetNames()
Columns(1).Insert
For i = 1 To Sheets.Count
Cells(i, 1) = Sheets(i).Name
Next i
End Sub
 
Last edited:
Upvote 0
Code:
Dim i As Long

With ThisWorkbook
    For i = 1 to .Sheets.Count
        Cells(i, 1).Value = .Sheets(i).Name
    Next i
End With
 
Upvote 0
excel stores the sheet number and name is it possible to get the sheet number in 1 column and the name of the sheet in a 2nd column

column a columnb
sheet? value
 
Upvote 0
this piece of code deals with the displaying of the name

Cells(i, 1).Value = .Sheets(i).Name

what I don't know is how to get the .Sheets section to display, I tried

Cells(i, 1).Value = .Sheets(i).Value

I guess I can't figure out what goes on the underlined part of code
 
Upvote 0
Notice that the variable i is the index of the sheet (which you want in column 1)
and Sheet(i).Name is the name of the sheet (which you want in column 2)
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,284
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top