如果只与"sheet2“行"b”上的值匹配,我正在尝试为工作表"Tables“中的范围创建超链接,但出现"invalid procedure call or argument”错误。我在网上寻找解决方案,但什么也找不到。有没有人能帮我写一下下面的代码;
Sub Macro1()
For i = 4 To 23
If Cells(i, "A").Value <> "" Then
k = Sheets("TABLES").Cells(i, "a").Value
c = Application.Match(k, Sheets("Sheet2").Range("B11:B500000"), 0)
If IsError(c) Then
Else
Sheets("tables").Hyperlinks.Add Anchor:=Sheets("tables").Cells(i, "A"), _
Address:="", _
SubAddress:="sheet2!F" & c, _
TextToDisplay:=k
End If
End If
Next i
End Sub发布于 2019-01-19 11:13:32
超级链接噩梦
Option Explicit
Sub Error5()
Dim i As Long
Dim k As Long
Dim c As Variant
With Sheets("Tables")
For i = 4 To 23
If .Cells(i, "A").Value <> "" Then
k = .Cells(i, "A").Value
c = Application.Match(k, Sheets("Sheet2") _
.Range("B11:B50000"), 0)
If IsError(c) Then
Else
.Hyperlinks.Add _
Anchor:=.Cells(i, "A"), _
Address:="", _
SubAddress:="Sheet2!F" & c, _
TextToDisplay:=CStr(k)
End If
End If
Next
End With
End Sub发布于 2019-01-19 09:57:06
将If Cells(i, "A").Value <> "" Then更改为If Sheets("TABLES").Cells(i, "a").Value <> "" Then~希望它能正常工作。它无法识别第一行中的对象。
https://stackoverflow.com/questions/54263148
复制相似问题