创建到另一个单元格的超链接 [英] Create hyperlink to another cell

查看:150
本文介绍了创建到另一个单元格的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在VBA中创建一个超链接,当链接到HTML时,它将跳转到一个特定的单元格。

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

例如:

ActiveSheet.Hyperlinks.Add Anchor:=Cells(1, 2), Address:=range("B23"), TextToDisplay:="Test Link"

但是,上述不起作用,因为它没有找到地址

However the above doesn't work as it says address not found

推荐答案

您需要 SubAddress 参数.microsoft.com / en-us / library / office / ff822490.aspxrel =nofollow> Hyperlinks.Add方法,而不是地址。 / p>

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

这篇关于创建到另一个单元格的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆