如何在另一个工作表中包含指向单元格的超链接?

时间:2017-07-21 18:03:52

标签: excel-vba hyperlink vba excel

我想将显示的文本变成一个超链接,当您选择显示的文本时,它会将您带到工作表和单元格。

我做错了什么?

提前谢谢你,

If wb.sheets("Coversheet").Cells(lastRowC, 8) <> WS.Cells(i, 5) Then
    wb.sheets("Coversheet").Cells(lastRowC + 1, 2) = "Carrier"
    wb.sheets("Coversheet").Cells(lastRowC + 1, 3) = "Employee with a $0 salary found. Unable to calculate salary based benefits. Please rerun Census report"
    wb.sheets("Coversheet").Cells(lastRowC + 1, 4) = WS.Cells(i, 4).Hyperlinks(1).Address
End If

1 个答案:

答案 0 :(得分:0)

我只是在你的情况下这样做来创建超链接。它灵活且易于操作。

Dim hyperlinkLocation As String
hyperlinkLocation = "[ActiveWorkBook.Name"&".xls]1!A1" '<- 1 is the sheet index (important in your case)   


 ActiveWorkSheet.Hyperlinks.Add Anchor:=.(where the link is), Address:=hyperlinkLockation, _ 
        TextToDisplay:=(name of the link)