Hyperlinked Table of Contents

golclub

New Member
Joined
Aug 1, 2011
Messages
3
Hi all

Could you please help me. I need a macro which would create a hyperlinked Table of Contents on Sheet 1 with names taken from the first cell of each sheet. For example A1 of Sheet 2 has heading Canada, A1 of Sheet 3 - America, A1 of Sheet 4 - Mexico, etc.

So the hyperlinked Table of Contents on Sheet 1 would look like

Canada
America
Mexico
..........
.........

untill the name from the A1 of the last sheet.

After that if a user clicks any hyperlink from the table of contents the macro would open the corresponding sheet.


Thanks a lot!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Hi all

Could you please help me. I need a macro which would create a hyperlinked Table of Contents on Sheet 1 with names taken from the first cell of each sheet. For example A1 of Sheet 2 has heading Canada, A1 of Sheet 3 - America, A1 of Sheet 4 - Mexico, etc.

So the hyperlinked Table of Contents on Sheet 1 would look like

Canada
America
Mexico
..........
.........

untill the name from the A1 of the last sheet.

After that if a user clicks any hyperlink from the table of contents the macro would open the corresponding sheet.


Thanks a lot!


Hi,
Is there a fixed number of sheets? or does it change alot?
 
Upvote 0
Try this it works for me...

Code:
Private Sub Worksheet_Activate()
    For i = 2 To Sheets.Count
        Set TOC = Range("A" & i)
 
         TOC.Hyperlinks.Add Anchor:=TOC, Address:="", SubAddress:= _
        Sheets(i).Name & "!" & "A1", TextToDisplay:=Sheets(i).Range("A1").Text
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,671
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top