Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How to get list of worksheet names?

 
   Macintosh computer (Home) -> Excel RSS
Next:  Am I the only user with this problem  
Author Message
Robert Li

External


Since: Aug 29, 2003
Posts: 3



(Msg. 1) Posted: Fri Aug 29, 2003 8:28 am
Post subject: How to get list of worksheet names?
Archived from groups: microsoft>public>mac>office>excel (more info?)

I am working with a large Excel file that contains over
100 worksheets. I need a list of all the worksheet
names. Can someone tell me how to get this list, other
than copy each one at a time?

Thanks,
Robert

 >> Stay informed about: How to get list of worksheet names? 
Back to top
Login to vote
J.E. McGimpsey

External


Since: Dec 25, 2003
Posts: 551



(Msg. 2) Posted: Fri Aug 29, 2003 12:34 pm
Post subject: Re: How to get list of worksheet names? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <0a6101c36e29$1702a670$a501280a@phx.gbl>,
"Robert Li" <yinquan_li RemoveThis @yahoo.com> wrote:

 > I am working with a large Excel file that contains over
 > 100 worksheets. I need a list of all the worksheet
 > names. Can someone tell me how to get this list, other
 > than copy each one at a time?

You can do it with a macro:

Public Sub ListSheets()
Dim i As Long
For i = 1 to Worksheets.Count
ActiveSheet.Cells(i, 1).Value = Worksheets(i).Name
Next i
End Sub

This macro will insert a new sheet at the left of your workbook and
list all the sheets in the workbook:

Public Sub ListSheetsToNewSheet()
Const SHTNAME As String = "Index to Sheets"
Dim indexSheet As Worksheet
Dim i As Long
On Error Resume Next
Worksheets(SHTNAME).Delete
On Error GoTo 0
With Worksheets.Add(before:=Worksheets(1))
.Name = SHTNAME
For i = 1 To Worksheets.Count
.Cells(i, 1).Value = Worksheets(i).Name
Next i
End With
End Sub

If you're unfamiliar with macros, take a look at David McRitchie's
Getting started with Macros page - it's Windows oriented, but most
of the information is directly applicable to Macs.

<a style='text-decoration: underline;' href="http://www.mvps.org/dmcritchie/excel/getstarted.htm" target="_blank">http://www.mvps.org/dmcritchie/excel/getstarted.htm</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: How to get list of worksheet names? 
Back to top
Login to vote
Michael R Middleto

External


Since: Aug 29, 2003
Posts: 17



(Msg. 3) Posted: Fri Aug 29, 2003 2:34 pm
Post subject: Re: How to get list of worksheet names? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Robert Li -

 > I am working with a large Excel file that contains over 100 worksheets. I
need a list of all the worksheet names. Can someone tell me how to get this
list, other than copy each one at a time? <

My Mac isn't available now to check, but there's likely a Mac feature
similar to the following Windows method:

If you only need to make navigation easy (instead of using a macro to get a
list), you can right-click on the left-right arrows to the left of the
worksheet tabs to get a list.

- Mike Middleton, <a style='text-decoration: underline;' href="http://www.usfca.edu/~middleton" target="_blank">www.usfca.edu/~middleton</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: How to get list of worksheet names? 
Back to top
Login to vote
Robert Li

External


Since: Aug 29, 2003
Posts: 3



(Msg. 4) Posted: Fri Aug 29, 2003 4:01 pm
Post subject: Re: How to get list of worksheet names? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

 >-----Original Message-----
 >In article <0a6101c36e29$1702a670$a501280a@phx.gbl>,
 > "Robert Li" <yinquan_li.TakeThisOut@yahoo.com> wrote:
 >
  >> I am working with a large Excel file that contains over
  >> 100 worksheets. I need a list of all the worksheet
  >> names. Can someone tell me how to get this list, other
  >> than copy each one at a time?
 >
 >You can do it with a macro:
 >
 > Public Sub ListSheets()
 > Dim i As Long
 > For i = 1 to Worksheets.Count
 > ActiveSheet.Cells(i, 1).Value = Worksheets
(i).Name
 > Next i
 > End Sub
 >
 >This macro will insert a new sheet at the left of your
workbook and
 >list all the sheets in the workbook:
 >
 > Public Sub ListSheetsToNewSheet()
 > Const SHTNAME As String = "Index to Sheets"
 > Dim indexSheet As Worksheet
 > Dim i As Long
 > On Error Resume Next
 > Worksheets(SHTNAME).Delete
 > On Error GoTo 0
 > With Worksheets.Add(before:=Worksheets(1))
 > .Name = SHTNAME
 > For i = 1 To Worksheets.Count
 > .Cells(i, 1).Value = Worksheets(i).Name
 > Next i
 > End With
 > End Sub
 >
 >If you're unfamiliar with macros, take a look at David
McRitchie's
 >Getting started with Macros page - it's Windows oriented,
but most
 >of the information is directly applicable to Macs.
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.mvps.org/dmcritchie/excel/getstarted.htm</font" target="_blank">http://www.mvps.org/dmcritchie/excel/getstarted.htm</font</a>>
 >.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: How to get list of worksheet names? 
Back to top
Login to vote
Robert Li

External


Since: Aug 29, 2003
Posts: 3



(Msg. 5) Posted: Fri Aug 29, 2003 4:02 pm
Post subject: Re: How to get list of worksheet names? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks a lot for the help. I figured it out by going to
the help file and reading web pages. The solution is just
like you had suggested.

Robert

 >-----Original Message-----
 >In article <0a6101c36e29$1702a670$a501280a@phx.gbl>,
 > "Robert Li" <yinquan_li.RemoveThis@yahoo.com> wrote:
 >
  >> I am working with a large Excel file that contains over
  >> 100 worksheets. I need a list of all the worksheet
  >> names. Can someone tell me how to get this list, other
  >> than copy each one at a time?
 >
 >You can do it with a macro:
 >
 > Public Sub ListSheets()
 > Dim i As Long
 > For i = 1 to Worksheets.Count
 > ActiveSheet.Cells(i, 1).Value = Worksheets
(i).Name
 > Next i
 > End Sub
 >
 >This macro will insert a new sheet at the left of your
workbook and
 >list all the sheets in the workbook:
 >
 > Public Sub ListSheetsToNewSheet()
 > Const SHTNAME As String = "Index to Sheets"
 > Dim indexSheet As Worksheet
 > Dim i As Long
 > On Error Resume Next
 > Worksheets(SHTNAME).Delete
 > On Error GoTo 0
 > With Worksheets.Add(before:=Worksheets(1))
 > .Name = SHTNAME
 > For i = 1 To Worksheets.Count
 > .Cells(i, 1).Value = Worksheets(i).Name
 > Next i
 > End With
 > End Sub
 >
 >If you're unfamiliar with macros, take a look at David
McRitchie's
 >Getting started with Macros page - it's Windows oriented,
but most
 >of the information is directly applicable to Macs.
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.mvps.org/dmcritchie/excel/getstarted.htm</font" target="_blank">http://www.mvps.org/dmcritchie/excel/getstarted.htm</font</a>>
 >.
 ><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: How to get list of worksheet names? 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Excel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]