List of Sheets

  • Thread starter Thread starter Jahsonn
  • Start date Start date
J

Jahsonn

Hi Guys....

Is there an easy way to list all sheet names from a
workbook in a sheet on the workbook?

TIA
 
i=1
For Each sh In Activeworkbook.Sheets
Cells(i,"A").Value = sh.Name
i=i+1
Next sh

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Dim rw as Long, sh as Worksheet
rw = 3
for each sh in Activeworkbook.worksheets
worksheets("Listing").Cells(rw,1).Value = sh.name
rw = rw + 1
Next
 
Hi Thanks For your posts,

I have tried amending the code so that it will only
display names of sheets after the 4th sheet.

Sub test()

With Worksheets("Control")
i = 17
For sh = 5 To Worksheets.Count
Cells(i, "B").Value = sh.Name
i = i + 1
Next sh
End With

End Sub

But this is coming up with an error - Can anyone help?
 
Dim rw as Long, sh as Worksheet
Dim bStart as Boolean
rw = 17
for each sh in Activeworkbook.worksheets
if bStart then
worksheets("Control").Cells(rw,2).Value = sh.name
rw = rw + 1
End if
if sh.Name = worksheets(4).Name then bStart = true
Next
 
In this instance, sh is an object not an index. Try

Sub test()

With Worksheets("Control")
i = 17
For sh = 5 To Worksheets.Count
Cells(i, "B").Value = worksheets(sh).Name
Next sh
End With

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Try this:

Sub WorkSheetNames()
Dim sht As Worksheet
Dim mySht As Worksheet
Set mySht = Sheets("Sheet1")
Dim r As Integer
Dim c As Integer
r = 1
c = 1
For Each sht In Worksheets
mySht.Cells(r, c) = sht.Name
r = r + 1
Next sht
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top