Create hyperlink to another cell

后端 未结 2 906
不知归路
不知归路 2021-01-24 08:04

I want to have a hyperlink created in VBA which will jump to a specific cell when clicked, similar to an HTML anchor link.

For instance:

ActiveSheet.Hype         


        
相关标签:
2条回答
  • 2021-01-24 08:18

    Try that way:

    ActiveSheet.Hyperlinks.Add Anchor:=ActiveSheet.Range("E5"), Address:="", SubAddress:="Sheet1!A1", TextToDisplay:="Sheet1!A1"
    
    0 讨论(0)
  • 2021-01-24 08:23

    You need the SubAddress parameter of the Hyperlinks.Add method, not the Address.

    with ActiveSheet
        .Hyperlinks.Add Anchor:=.Cells(1, 2), _
                        Address:="", _
                        SubAddress:= .Name & "!$B$23", _
                        TextToDisplay:="Test Link"
    end with
    
    0 讨论(0)
提交回复
热议问题