在实际工作簿中超链接到工作表 [英] Hyperlink to Worksheet in actual Workbook
问题描述
如何将超链接添加到特定单元格并将其寻址到Excel文件中的工作表?
How can i add a Hyperlink to a specific cell and address 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"
地址应为空,子地址的格式应为Sheet1!A1.假定您有一个名为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"
假设Workbooks(1)是一个不同的文件,并且以前已经保存过,并且具有正确名称的工作表,等等,等等.
Assuming Workbooks(1) is a different file and has been previously saved and has a sheet with the right name, etc, etc.
这篇关于在实际工作簿中超链接到工作表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!