Results 1 to 2 of 2

Hyperlinks with hidden sheets

Threaded View

  1. #1
    Registered User
    Join Date
    05-20-2009
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    17

    Unhappy Hyperlinks with hidden sheets

    Hello all, I am working with a file that i have multiple sheets. I have code that is written to automatically hid the sheets except the Index. I have hyperlinks that go to the various sheets but I am also trying to have hyperlinks to go to a website. When clicking on the hyperlinks for the website, I get a error as follows:

    Run-time error '9':
    Subscript out of range.

    Here is the code I am using to hid and activate the sheets when the hyperlink is selected. PLEASE HELP!

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
        
       Dim strSheet As String
         
       If InStr(Target.Parent, "!") > 0 Then
          strSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
       Else
          strSheet = Target.Parent
       End If
        
       Sheets(strSheet).Visible = True
       Sheets(strSheet).Select
        
    End Sub
    Private Sub Worksheet_Activate()
        
       Dim ws As Excel.Worksheet
        
       For Each ws In ThisWorkbook.Worksheets
          ws.Visible = (ws.Name = Me.Name)
       Next
        
    End Sub
    Last edited by jespvik; 04-04-2013 at 03:54 PM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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