Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default short version of Index/Table of Contents

Yesterday I saw a short formula that made a simple TOC of worksheet (tab)
names. By entering a new sheet and using code, I was able to return in that
new sheet the list of all worksheet names for the user to see quickly. The
code did not save and I cannot find it.

It was not the long version posted in most responses via the hyperlink to
mvps.org.

If anyone gave that other short answer, please respond. thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default short version of Index/Table of Contents

Sub MakeTOC()
Dim sh as Worksheet
Dim i as Long
i = 1
Worksheets(1).Cells(1,1).Value = "Sheets"
for each sh in thisworkbook.Worksheets
i = i + 1
worksheets(1).Cells(i,1).Value = sh.name
next
End Sub

--
Regards,
Tom Ogilvy


"amyc" wrote in message
...
Yesterday I saw a short formula that made a simple TOC of worksheet (tab)
names. By entering a new sheet and using code, I was able to return in

that
new sheet the list of all worksheet names for the user to see quickly.

The
code did not save and I cannot find it.

It was not the long version posted in most responses via the hyperlink to
mvps.org.

If anyone gave that other short answer, please respond. thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default short version of Index/Table of Contents

thank you - that's it!

"Tom Ogilvy" wrote:

Sub MakeTOC()
Dim sh as Worksheet
Dim i as Long
i = 1
Worksheets(1).Cells(1,1).Value = "Sheets"
for each sh in thisworkbook.Worksheets
i = i + 1
worksheets(1).Cells(i,1).Value = sh.name
next
End Sub

--
Regards,
Tom Ogilvy


"amyc" wrote in message
...
Yesterday I saw a short formula that made a simple TOC of worksheet (tab)
names. By entering a new sheet and using code, I was able to return in

that
new sheet the list of all worksheet names for the user to see quickly.

The
code did not save and I cannot find it.

It was not the long version posted in most responses via the hyperlink to
mvps.org.

If anyone gave that other short answer, please respond. thanks.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default short version of Index/Table of Contents

Not sure what you saw but this is a simple way of listing all worksheets in
workbook on the active worksheet - it might be what you need?

Sub Toc()
Dim xrow As Integer
For xrow = 1 To wb.Worksheets.Count
Cells(xrow, 1) = Worksheets(xrow).Name
Next
End Sub

--
Cheers
Nigel



"amyc" wrote in message
...
Yesterday I saw a short formula that made a simple TOC of worksheet (tab)
names. By entering a new sheet and using code, I was able to return in

that
new sheet the list of all worksheet names for the user to see quickly.

The
code did not save and I cannot find it.

It was not the long version posted in most responses via the hyperlink to
mvps.org.

If anyone gave that other short answer, please respond. thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default short version of Index/Table of Contents

Hi, despite several tries at running your sub,
it froze at this line:

For xrow = 1 To wb.Worksheets.Count


What can I do ?
Thanks
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Nigel" wrote in message
...
Not sure what you saw but this is a simple way of listing all worksheets

in
workbook on the active worksheet - it might be what you need?

Sub Toc()
Dim xrow As Integer
For xrow = 1 To wb.Worksheets.Count
Cells(xrow, 1) = Worksheets(xrow).Name
Next
End Sub





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default short version of Index/Table of Contents

Apologies - modify as follows.......

Dim wb As Workbook
Set wb = ActiveWorkbook
Dim xrow As Integer
For xrow = 1 To wb.Worksheets.Count
Cells(xrow, 1) = Worksheets(xrow).Name
Next

OR use this ........

Dim xrow As Integer
For xrow = 1 To ActiveWorkbook.Worksheets.Count
Cells(xrow, 1) = Worksheets(xrow).Name
Next



--
Cheers
Nigel



"Max" wrote in message
...
Hi, despite several tries at running your sub,
it froze at this line:

For xrow = 1 To wb.Worksheets.Count


What can I do ?
Thanks
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"Nigel" wrote in message
...
Not sure what you saw but this is a simple way of listing all worksheets

in
workbook on the active worksheet - it might be what you need?

Sub Toc()
Dim xrow As Integer
For xrow = 1 To wb.Worksheets.Count
Cells(xrow, 1) = Worksheets(xrow).Name
Next
End Sub





  #7   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default short version of Index/Table of Contents

Thanks, Nigel !
Runs great now ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default short version of Index/Table of Contents

You would want to change that Integer to Long
as it is referring to rows.

"Max" wrote in message ...
Thanks, Nigel !
Runs great now ..




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default short version of Index/Table of Contents

I would suggest that you sort your list

Simple macro to populate with Sheetnames with a Sort (#SheetNamesSortedDownRows)
://www.mvps.org/dmcritchie/excel/buildtoc2.htm#SheetNamesSortedDownRows

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"amyc" wrote in message ...
Yesterday I saw a short formula that made a simple TOC of worksheet (tab)
names. By entering a new sheet and using code, I was able to return in that
new sheet the list of all worksheet names for the user to see quickly. The
code did not save and I cannot find it.

It was not the long version posted in most responses via the hyperlink to
mvps.org.

If anyone gave that other short answer, please respond. thanks.



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
Using cell's contents as an index to a row ... ? Mac Excel Worksheet Functions 1 February 14th 09 12:07 AM
Using cell's contents as an index to a row ... ? Mac Excel Worksheet Functions 0 February 13th 09 11:36 PM
Using Alt I short cut in 2007 version Henning Excel Discussion (Misc queries) 3 November 29th 07 12:05 PM
Table of contents/index Peter Barker Excel Discussion (Misc queries) 5 February 10th 07 05:26 PM
Index/Contents Sheet philiphales Excel Discussion (Misc queries) 2 September 9th 05 08:58 AM


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

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

About Us

"It's about Microsoft Excel"