Solved

How to Modify Worksheet Hyperlink Index

Posted on 2015-02-23
2
56 Views
Last Modified: 2016-02-10
The attached workbook has 13 worksheets in it.

Worksheet "Index" uses an "OnActivate" code to build hyperlinks to the other sheets.

Is there a way to have worksheets that have a property value of "xlSheetVeryHidden" NOT included in this list?

Can it be modified to create two lists: One for worksheets, one for Charts?

Regards,

Thank you to OzGrid for the start on this.
Hyperlink-Index.xlsm
0
Comment
Question by:DougDodge
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40625828
Hi,

pls try

Option Explicit

Private Sub Worksheet_Activate()

Dim wSheet As Worksheet
Dim chrt As Chart
Dim l As Long

l = 1

    With Me
        .Columns(1).ClearContents
        .Cells(1, 1) = "INDEX TO WORKSHEETS"
        .Cells(1, 1).Name = "Index"
    End With
    

    For Each wSheet In Worksheets
        If wSheet.Name <> Me.Name And wSheet.Visible <> xlSheetVeryHidden Then
            l = l + 1
                With wSheet
                    .Range("A1").Name = "Start_" & wSheet.Index
                    .Hyperlinks.Add Anchor:=.Range("A1"), Address:="", SubAddress:="Index", TextToDisplay:="Return to Main Worksheet"
                End With

                Me.Hyperlinks.Add Anchor:=Me.Cells(l, 1), Address:="", SubAddress:="Start_" & wSheet.Index, TextToDisplay:=wSheet.Name
        End If
    Next wSheet
l = 1
    With Me
        .Columns(2).ClearContents
        .Cells(1, 2) = "INDEX TO CHARTS"
        .Cells(1, 2).Name = "Index"
    End With
    

    For Each chrt In Charts
        If chrt.Name <> Me.Name  And chrt.Visible <> xlSheetVeryHidden  Then
            l = l + 1
                Me.Hyperlinks.Add Anchor:=Me.Cells(l, 2), Address:="", SubAddress:="Start_" & chrt.Index, TextToDisplay:=chrt.Name
        End If
    Next chrt

End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:DougDodge
ID: 40626281
Works perfectly...... Thank you once again for your assistance......
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now