Solved

How to Modify Worksheet Hyperlink Index

Posted on 2015-02-23
2
67 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 51

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
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…

724 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