Over a year ago a member of this forum directed me to a web sight with the code for a macro to build a table of contents in a work book. I have since deleted the macro and now I need it again. Can anyone help.
Thanks
Over a year ago a member of this forum directed me to a web sight with the code for a macro to build a table of contents in a work book. I have since deleted the macro and now I need it again. Can anyone help.
Thanks
I don't know the web site, but are you trying to generate a list (hyperlinks)
of the sheets in your workbook? You could do that with (or something like)
the following (which begins the list in the active cell - be sure not to
overwrite anything you need):
Sub TOC()
Dim i As Long
Dim Counter As Long
Counter = 0
For i = 1 To Sheets.Count
If Sheets(i).Name <> ActiveSheet.Name Then
ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell.Offset(Counter, 0), _
Address:="", SubAddress:=Sheets(i).Name & "!A1", _
TextToDisplay:=Sheets(i).Name
Counter = Counter + 1
End If
Next i
End Sub
"phil1ray" wrote:
>
> Over a year ago a member of this forum directed me to a web sight with
> the code for a macro to build a table of contents in a work book. I
> have since deleted the macro and now I need it again. Can anyone help.
>
> Thanks
>
>
> --
> phil1ray
> ------------------------------------------------------------------------
> phil1ray's Profile: http://www.excelforum.com/member.php...fo&userid=6416
> View this thread: http://www.excelforum.com/showthread...hreadid=510909
>
>
I bet it was David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/buildtoc.htm
phil1ray wrote:
>
> Over a year ago a member of this forum directed me to a web sight with
> the code for a macro to build a table of contents in a work book. I
> have since deleted the macro and now I need it again. Can anyone help.
>
> Thanks
>
> --
> phil1ray
> ------------------------------------------------------------------------
> phil1ray's Profile: http://www.excelforum.com/member.php...fo&userid=6416
> View this thread: http://www.excelforum.com/showthread...hreadid=510909
--
Dave Peterson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks