Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,069
Default list sheets in workbook

Hello to all...
I have found this community to be very helpful for a new user like me. I
have used many examples displayed throughout the sessions. What I would like
to do is list the sheets in my workbook on sheet 1 but exclude sheet 1 in the
list, starting with sheet 2 through sheet end.
I have found the code that list all sheets which will work but I would like
to eliminate the first sheet though.

Any example of code would be nice. Thanks in advance...

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default list sheets in workbook

Hi,

I am assuming sheet1 is the first sheet in your workbook. Right click a
sheet tab, view code and paste this in and run it

Sub Sonic()
For x = 2 To Worksheets.Count
Sheets("Sheet1").Cells(x - 1, 1).Value = Sheets(x).Name
Next
End Sub

If sheet 1 isn't the first sheet then use this

Sub Sonic()
For x = 1 To Worksheets.Count
If Sheets(x).Name < "Sheet1" Then
Sheets("Sheet1").Cells(x - 1, 1).Value = Sheets(x).Name
End If
Next
End Sub


Mike

"John" wrote:

Hello to all...
I have found this community to be very helpful for a new user like me. I
have used many examples displayed throughout the sessions. What I would like
to do is list the sheets in my workbook on sheet 1 but exclude sheet 1 in the
list, starting with sheet 2 through sheet end.
I have found the code that list all sheets which will work but I would like
to eliminate the first sheet though.

Any example of code would be nice. Thanks in advance...

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default list sheets in workbook

Try something like

Sub AAA()
Dim StartCell As Range
Dim N As Long
Set StartCell = Range("A1") '<<< CHANGE
With ThisWorkbook.Worksheets
For N = 2 To .Count
StartCell(N - 1, 1).Value = .Item(N).Name
Next N
End With
End Sub

Change the reference to A1 to the cell in which you want to list to
begin.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Tue, 10 Mar 2009 14:35:01 -0700, John
wrote:

Hello to all...
I have found this community to be very helpful for a new user like me. I
have used many examples displayed throughout the sessions. What I would like
to do is list the sheets in my workbook on sheet 1 but exclude sheet 1 in the
list, starting with sheet 2 through sheet end.
I have found the code that list all sheets which will work but I would like
to eliminate the first sheet though.

Any example of code would be nice. Thanks in advance...

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 857
Default list sheets in workbook

Hi,

And here is another approach

Sub GetNames()
Dim sh As Worksheet
Dim I As Integer
For Each sh In Worksheets
If sh.Index 1 Then
Sheets(1).[A1].Offset(I) = sh.Name
I = I + 1
End If
Next sh
End Sub

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"John" wrote:

Hello to all...
I have found this community to be very helpful for a new user like me. I
have used many examples displayed throughout the sessions. What I would like
to do is list the sheets in my workbook on sheet 1 but exclude sheet 1 in the
list, starting with sheet 2 through sheet end.
I have found the code that list all sheets which will work but I would like
to eliminate the first sheet though.

Any example of code would be nice. Thanks in advance...

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
List Sheets excluding sheets named ***-A Dolphinv4 Excel Discussion (Misc queries) 1 December 15th 07 10:29 AM
List all sheets present in Workbook Jeff Excel Worksheet Functions 6 November 9th 06 10:03 PM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
add new sheets in a workbook with new sheets being a variable [email protected] Excel Discussion (Misc queries) 1 April 11th 06 08:38 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM


All times are GMT +1. The time now is 09:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"