实际工作簿中工作表的超链接

发布于 2024-10-14 18:49:20 字数 244 浏览 2 评论 0原文

如何将超链接添加到特定单元格并将其寻址到 Excel 文件中的工作表?

这就是我已经得到的:

Cells(zeile, 1).Select
Worksheets(1).Hyperlinks.Add Anchor:=Selection, Address:=Workbooks(1).Worksheets(fortnr), SubAddress:=Cells(1, 1).Address

谢谢。

How can i add a Hyperlink to a specific cell and address it to a Worksheet in the Excel file?

This is what I already got:

Cells(zeile, 1).Select
Worksheets(1).Hyperlinks.Add Anchor:=Selection, Address:=Workbooks(1).Worksheets(fortnr), SubAddress:=Cells(1, 1).Address

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

并安 2024-10-21 18:49:20
ActiveSheet.Hyperlinks.Add ActiveCell, "", Sheets(fortnr).Name & "!A1"

地址应为空,子地址应采用 Sheet1!A1 的形式。这会在活动单元格中放置一个链接,假设您有一个名为 fortnr 的变量,该变量在同一工作簿中包含有效的工作表名称。

如果您想指向不同工作簿中的单元格,则一切都相同,只是地址必须是该文件。

ActiveSheet.Hyperlinks.Add ActiveCell, Workbooks(1).FullName, Sheets(fortnr).Name & "!A1"

假设 Workbooks(1) 是一个不同的文件,并且之前已保存并具有正确名称的工作表等。

ActiveSheet.Hyperlinks.Add ActiveCell, "", Sheets(fortnr).Name & "!A1"

The Address should be blank and the SubAddress should be in the form Sheet1!A1. This puts a link in the activecell assuming you have a variable named fortnr that contains a valid sheet name in the same workbook.

If you want to point to a cell in a different workbook, then everything is the same except the Address needs to be that file.

ActiveSheet.Hyperlinks.Add ActiveCell, Workbooks(1).FullName, Sheets(fortnr).Name & "!A1"

Assuming Workbooks(1) is a different file and has been previously saved and has a sheet with the right name, etc, etc.

与风相奔跑 2024-10-21 18:49:20

想法 1:向当前活动单元格添加超链接

假设要链接的工作表名称是“VBA1”

ActiveSheet.Hyperlinks.Add Activecell, "", "VBA1!A1"

想法 2:向名为“CallButton”的形状添加超链接

ActiveSheet.Hyperlinks.Add ActiveSheet.Shapes("CallButton"), "", "VBA1!A1"

Idea 1: Add a hyperlink to current active cell

Assume the sheet name to link to is "VBA1"

ActiveSheet.Hyperlinks.Add Activecell, "", "VBA1!A1"

Idea 2: Add a hyperlink to a shape that is named as "CallButton"

ActiveSheet.Hyperlinks.Add ActiveSheet.Shapes("CallButton"), "", "VBA1!A1"

秋千易 2024-10-21 18:49:20

如果您尝试通过 UI 执行此操作:

  • 转到插入、超链接

  • 选择本文档中的位置

  • 选择工作表以及要添加的单元格。

这些链接将添加到您的电子表格中。

输入图片此处描述

If you are trying to do this via UI:

  • Go to Insert, Hyperlink

  • Select Place in This Document

  • Select the worksheets and the cells you want to add.

The links will be added in your spreasheet.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文