Solved

How to Modify Worksheet Hyperlink Index

Posted on 2015-02-23
2
63 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 49

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

813 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

8 Experts available now in Live!

Get 1:1 Help Now