【发布时间】:2021-12-02 23:40:57
【问题描述】:
我的代码如下所示:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim searchFolder As String, fileName As String
Static PowerPointApp As Object
If Target.Column = 3 Then
If Target.CountLarge > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
With Application
Msg = .IfError(.VLookup(Target.Text, Worksheets("Test").Columns("A:B"), 2, 0), "")
If Msg <> "" Then MsgBox Target.Value & vbLf & vbLf & Msg, vbInformation, "Suggestion d'inspection"
End With
End If
End Sub
它检查来自 Sheet 1 中 Col A 的单元格内容与来自 Sheet 2, Col 1 的列表;如果匹配,则 MsgBox 将提供来自 Col 2 的结果单元格的偏移值的信息。
我正在尝试将其调整为另一个执行相同检查的函数,但它不会显示来自偏移单元格的消息,而是会打开来自同一单元格的超链接。
举个例子:
我把“信息 X”放在 A:1 Sheet1 中;它检查 Col A Sheet 2,如果在 A45 中有匹配项,它将打开 B45 中的链接。
【问题讨论】:
标签: vba hyperlink lookup offset