Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
List Sheets excluding sheets named ***-A | Excel Discussion (Misc queries) | |||
List all sheets present in Workbook | Excel Worksheet Functions | |||
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA | Excel Worksheet Functions | |||
add new sheets in a workbook with new sheets being a variable | Excel Discussion (Misc queries) | |||
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? | Excel Worksheet Functions |