how to create toc based on tab names

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

how to create toc based on the tab names in the workbook and hyperlink them?
 
Hi
Right click the worksheet where you want to have the toc and select
"View Code".
In the VB Screen add the following macro.

Sub Worksheet_Activate()
Dim wSheet As Worksheet
l = 1
With Me
.Columns(1).Clear
.Cells(1, 1) = "INDEX"
End With

For Each wSheet In Worksheets
If wSheet.Name <> Me.Name Then
l = l + 1
t$ = "'" & wSheet.Name & "'!A1"
x$ = wSheet.Name
ActiveSheet.Hyperlinks.Add Anchor:=Me.Cells(l, 1),
Address:="", SubAddress:=t$, TextToDisplay:=x$
End If
Next wSheet

End Sub

Now close the VBA Screen. Go to some other worksheet and return to the
sheet where you entered the above code. You will have a toc with
hyperlinks

Thx
KB
http://www.orkut.com/Community.aspx?cmm=20758571
http://groups.google.co.in/group/ExcelFiles_India
http://excel2xl.blogspot.com/
 
Back
Top