实际工作簿中的现有工作表的超链接 [英] Hyperlink to Existing Worksheet in actual Workbook
问题描述
如何将超链接添加到特定单元格并将其添加到Excel文件中的工作表?
How can i add a Hyperlink to a specific Cell and adress it to a Worksheet in the excel file?
这是我已经得到的:
Cells(zeile, 1).Select
Worksheets(1).Hyperlinks.Add Anchor:=Selection, Address:=Workbooks(1).Worksheets(fortnr), SubAddress:=Cells(1, 1).Address
谢谢
推荐答案
ActiveSheet.Hyperlinks.Add ActiveCell, "", Sheets(fortnr).Name & "!A1"
地址应为空白,SubAddress的格式应为Sheet1!A1。这会在activecell中放置一个链接,假设您有一个名为fortnr的变量,该变量在同一工作簿中包含有效的工作表名称。
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"
假设工作簿(1)是一个不同的文件,之前已经保存并且有一个具有正确名称等的表格。
Assuming Workbooks(1) is a different file and has been previously saved and has a sheet with the right name, etc, etc.
这篇关于实际工作簿中的现有工作表的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!