Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Adding to a "list sheet names" macro ...

Thanks, as always, to the group for all the great help! We wouldn't
be as effective in our jobs without the help received here! <g

I have a few "list sheet names" macros but am missing a couple of
features which I'm hoping are easy to add.

Here is the macro that I'm working with now:

Sub SHEET_NAMES_list_all()
'list of sheet names starting at A1
Dim Rng As Range
Dim i As Long
Worksheets.Add(Befo=Worksheets(1)).Name = "ListOfSheetNames"
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub


1) I had one at one point that created a list of sheet names but
without including the list itself, the "ListOfSheetNames" one, in this
case. But after juggling and playing with a few, can't find the code
that did that. What needs to be changed above, pls, so that we'd get
a list of the original sheets only.

i.e., if I have sheets with the names of, say:

Addresses
Bill Payments
Financial Institutions

the list would just have those 3 sheet names and _not_ this:

ListOfSheetNames
Addresses
Bill Payments
Financial Institutions

2) Secondly, would there be a way to add numbering to the list itself
so that we'd get this type of thing?:

[1] Addresses
[2] Bill Payments
[3] Financial Institutions

The current workbook has many sheets and it would help when dealing
with them to have a # before them in the list.

Thanks! :oD
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Adding to a "list sheet names" macro ...

For Each Sheet In ActiveWorkbook.Sheets
If Not Sheet.Name = "ListOfSheetNames" Then
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
End If
Next Sheet




wrote in message
...
Thanks, as always, to the group for all the great help! We wouldn't
be as effective in our jobs without the help received here! <g

I have a few "list sheet names" macros but am missing a couple of
features which I'm hoping are easy to add.

Here is the macro that I'm working with now:

Sub SHEET_NAMES_list_all()
'list of sheet names starting at A1
Dim Rng As Range
Dim i As Long
Worksheets.Add(Befo=Worksheets(1)).Name = "ListOfSheetNames"
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub


1) I had one at one point that created a list of sheet names but
without including the list itself, the "ListOfSheetNames" one, in this
case. But after juggling and playing with a few, can't find the code
that did that. What needs to be changed above, pls, so that we'd get
a list of the original sheets only.

i.e., if I have sheets with the names of, say:

Addresses
Bill Payments
Financial Institutions

the list would just have those 3 sheet names and _not_ this:

ListOfSheetNames
Addresses
Bill Payments
Financial Institutions

2) Secondly, would there be a way to add numbering to the list itself
so that we'd get this type of thing?:

[1] Addresses
[2] Bill Payments
[3] Financial Institutions

The current workbook has many sheets and it would help when dealing
with them to have a # before them in the list.

Thanks! :oD



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Adding to a "list sheet names" macro ...

HI

With numbers in column A and Sheet names in column B try this:

Sub SHEET_NAMES_list_all()
'list of sheet names starting at B1
Dim Rng As Range
Dim Sheet As Worksheet
Dim i As Long

Worksheets.Add(Befo=Worksheets(1)).Name = "ListOfSheetNames"
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
If Sheet.Name < "ListOfSheetNames" Then
Rng.Offset(i, 1).Value = Sheet.Name
Rng.Offset(i, 0).Value = i + 1
i = i + 1
End If
Next
End Sub

Regards,
Per


skrev i meddelelsen
...
Thanks, as always, to the group for all the great help! We wouldn't
be as effective in our jobs without the help received here! <g

I have a few "list sheet names" macros but am missing a couple of
features which I'm hoping are easy to add.

Here is the macro that I'm working with now:

Sub SHEET_NAMES_list_all()
'list of sheet names starting at A1
Dim Rng As Range
Dim i As Long
Worksheets.Add(Befo=Worksheets(1)).Name = "ListOfSheetNames"
Set Rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
Rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub


1) I had one at one point that created a list of sheet names but
without including the list itself, the "ListOfSheetNames" one, in this
case. But after juggling and playing with a few, can't find the code
that did that. What needs to be changed above, pls, so that we'd get
a list of the original sheets only.

i.e., if I have sheets with the names of, say:

Addresses
Bill Payments
Financial Institutions

the list would just have those 3 sheet names and _not_ this:

ListOfSheetNames
Addresses
Bill Payments
Financial Institutions

2) Secondly, would there be a way to add numbering to the list itself
so that we'd get this type of thing?:

[1] Addresses
[2] Bill Payments
[3] Financial Institutions

The current workbook has many sheets and it would help when dealing
with them to have a # before them in the list.

Thanks! :oD


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
Work-around for lack of " ' " before/after sheet names with no spaces [email protected] Excel Programming 8 May 18th 07 03:46 AM
Response to "Can I get a list of names of all the tabs..." Bob Umlas, Excel MVP Excel Discussion (Misc queries) 0 January 31st 07 09:33 PM
Change default in input box from "20" to "000000"? Have macro continue on to name sheet tab? StargateFanFromWork[_4_] Excel Programming 7 October 29th 06 11:46 AM
Help,, need macro to replace 'space' in list of names with "." (dot), then compare ss jay Excel Programming 0 February 23rd 06 05:33 PM
Backup to specific folder if workbook names begins with "NSR" or "MAC" GregR Excel Programming 3 May 6th 05 12:24 AM


All times are GMT +1. The time now is 08:39 PM.

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"