none
Working with Hyperlinks RRS feed

  • Question

  • Hi,

     

    Can someone give some advice on following issue?

     

    There was a question on the Dutch Excel forum and the OP would like to have a master sheet with hyperlinks to the other sheets but all other sheets were hidden because he wanted that the user had only one sheet visible. Each other sheet has also an hyperlink to unhide the master sheet and hide the active sheet.

     

    I wrote following code:


    Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal
    Target As Hyperlink)
    
       Application.EnableEvents =
    False
    
       If Sheets(Split(Target.SubAddress,
    "!")(0)).Visible = False Then
    
         
    Sheets(Split(Target.SubAddress, "!")(0)).Visible = True
    
         
    Sh.Range(Target.Range.Address).Hyperlinks(1).Follow
    
       End If
    
       
    
       Sh.Visible = False
    
       Application.EnableEvents =
    True
    
    End Sub

     

    First, I was expecting that I could use Target.Follow as this is a method of it but that gave a runtime error, therefore Sh.Range(Target.Range.Address).Hyperlinks(1).Follow

     

    Another experienced member of the forum downloaded my sample workbook but it didn’t work for him. Can someone tell us what is wrong with my code and how to change it so it will also work on downloaded versions.

     

    My sample workbook:

    https://1drv.ms/x/s!AmIR8Z3XdrKRkiahiwbag_2w1nIo

    Regards,

    JP

    Wednesday, May 8, 2019 9:52 AM

Answers

  • I downloaded your sample workbook. It works perfectly for me in Excel 2019. I did have to unblock the .xlsm file first, of course, as with all downloaded files.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by JP Ronse Wednesday, May 8, 2019 10:54 AM
    Wednesday, May 8, 2019 10:37 AM

All replies

  • I downloaded your sample workbook. It works perfectly for me in Excel 2019. I did have to unblock the .xlsm file first, of course, as with all downloaded files.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    • Marked as answer by JP Ronse Wednesday, May 8, 2019 10:54 AM
    Wednesday, May 8, 2019 10:37 AM
  • Hi Hans,

    Thanks for confirmation.

    Regards,

    JP

    Wednesday, May 8, 2019 10:54 AM