+ Reply to Thread
Results 1 to 3 of 3

Building a TOC

  1. #1
    Registered User
    Join Date
    02-21-2004
    Posts
    2

    Building a TOC

    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

  2. #2
    JMB
    Guest

    RE: Building a TOC

    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
    >
    >


  3. #3
    Dave Peterson
    Guest

    Re: Building a TOC

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1