close

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: www.excelforum.com/member.php...foamp;userid=6416
View this thread: www.excelforum.com/showthread...hreadid=510909I 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 lt;gt; ActiveSheet.Name Then
ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell.Offset(Counter, 0), _
Address:=quot;quot;, SubAddress:=Sheets(i).Name amp; quot;!A1quot;, _
TextToDisplay:=Sheets(i).Name
Counter = Counter 1
End If
Next i

End Sub
quot;phil1rayquot; wrote:

gt;
gt; Over a year ago a member of this forum directed me to a web sight with
gt; the code for a macro to build a table of contents in a work book. I
gt; have since deleted the macro and now I need it again. Can anyone help.
gt;
gt; Thanks
gt;
gt;
gt; --
gt; phil1ray
gt; ------------------------------------------------------------------------
gt; phil1ray's Profile: www.excelforum.com/member.php...foamp;userid=6416
gt; View this thread: www.excelforum.com/showthread...hreadid=510909
gt;
gt;

I bet it was David McRitchie's site:
www.mvps.org/dmcritchie/excel/buildtoc.htm

phil1ray wrote:
gt;
gt; Over a year ago a member of this forum directed me to a web sight with
gt; the code for a macro to build a table of contents in a work book. I
gt; have since deleted the macro and now I need it again. Can anyone help.
gt;
gt; Thanks
gt;
gt; --
gt; phil1ray
gt; ------------------------------------------------------------------------
gt; phil1ray's Profile: www.excelforum.com/member.php...foamp;userid=6416
gt; View this thread: www.excelforum.com/showthread...hreadid=510909

--

Dave Peterson

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()