如何在Excel中找到引用单元格的超链接?超链接的反向
嗨,我想找到一种方法来追踪指向单元格的超链接。 例如: 一列中有5个随机单元格通过超链接引用D2单元格。所以当我转到D2时,我怎么知道什么是指D2的细胞 非常感谢你的回答 谢谢。检测特定的超链接如何在Excel中找到引用单元格的超链接?超链接的反向,excel,excel-formula,hyperlink,cell,traceability,Excel,Excel Formula,Hyperlink,Cell,Traceability,嗨,我想找到一种方法来追踪指向单元格的超链接。 例如: 一列中有5个随机单元格通过超链接引用D2单元格。所以当我转到D2时,我怎么知道什么是指D2的细胞 非常感谢你的回答 谢谢。检测特定的超链接 在一张工作表的列A中,尝试在另一张工作表上查找链接到单元格D2的单元格,并将找到的单元格的地址写入即时窗口 代码 Option Explicit Sub detectHyperlinks() ' Source Const srcName As String = "
- 在一张工作表的列
中,尝试在另一张工作表上查找链接到单元格A
的单元格,并将找到的单元格的地址写入即时窗口D2
Option Explicit
Sub detectHyperlinks()
' Source
Const srcName As String = "Sheet1"
Const srcFirst As String = "A1"
' Destination
Const dstName As String = "Sheet2"
Const dCellAddress As String = "D2"
' Define Source Column Range.
With ThisWorkbook.Worksheets(srcName)
Dim LastRow As Long
LastRow = .Cells(.Rows.Count, .Range(srcFirst).Column).End(xlUp).Row
Dim rng As Range
Set rng = .Range(cFirst).Resize(LastRow - .Range(cFirst).Row + 1)
End With
' Define Destination Address String.
Dim dAddr As String
dAddr = dstName & "!" & dCellAddress
Dim cel As Range ' Current Cell in Source Range
Dim sAddr As String ' Source Address String
' Iterate through cells in Source Column Range.
For Each cel In rng.Cells
' Evaluate if current cell does not contain an error or blank value.
If Not IsError(cel) And Not IsEmpty(cel.Value) Then
' Evaluate if current cell contains a hyperlink.
If cel.Hyperlinks.Count > 0 Then
' Write current cells Sub Address to Source Address String
' and remove the "'" and "$" characters.
sAddr = Replace(cel.Hyperlinks(1).SubAddress, "'", "")
sAddr = Replace(sAddr, "$", "")
' Allowing different case (vbTextCompare), evaluate
' if Source and Destination Address Strings are equal.
If StrComp(sAddr, dAddr, vbTextCompare) = 0 Then
' Do what you need to do with the found cell.
' For example print its address to the Immdediate window.
Debug.Print cel.Address
End If
End If
End If
Next cel
End Sub
是否使用HYPERLINK()工作表函数插入或创建了超链接??通过右键单击单元格并单击“插入链接”,然后链接到同一工作簿(不同工作表)中的单元格,可以为每个单元格创建超链接