• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Dynamic Hyperlink to a hidden worksheet.

Tanduay

New Member
The VBA Follow hyperlink works only if I use "Ctrl+K" hyperlink,

however it does not work on dynamic hyperlink using =hyperlink(#'Sheet!'A1,"FriendlyName")

Thank you
 
Your formula syntax is off. It should be...
=HYPERLINK("#'Sheet Name'!A1","FriendlyName")

Also, Excel does not treat hyperlink created with HYPERLINK() formula like manually added hyperlink and does not add it to collection. Therefore you can't use VBA follow hyperlink directly on formula generated hyperlink.

To go to HYPERLINK formula destination.

You can split the cell formula using double quote as delimiter to extract destination, and use code to add hyperlink to collection. Something like below (assuming Cell B2, in active sheet contains HYPERLINK formula).

Code:
Sub Test()

x = Split([B2].Formula, """")

[B2].Hyperlinks.Add anchor:=[B2], Address:="", SubAddress:=x(1)
[B2].Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub
 
Back
Top