我已经在Excel中的VBA中创建了一个程序,除了获取单元格值并将其添加到超链接末尾,然后将超链接添加到显示值的单元格的那一部分之外,其他所有功能都可以正常运行。这是我用于此部分的代码:
'Hyper Link column A
Dim WorkRng As Range
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", "Select Range", WorkRng.Address, Type:=8)
Dim l As Long
Dim addr As String
For l = WorkRng.Rows.Count To 1 Step -1
If WorkRng.Cells(l, 1).Value <> "" Then
addr = CStr("https://True&RequestID=") & CStr(WorkRng.Cells(l, 1).Value)
WorkRng.Cells(l, 1).Hyperlink.Add Anchor:=WorkRng.Cells(l, 1), _
Address:=addr, _
TextToDisplay:=CStr(WorkRng.Cells(i, 1).Value)
End If
Next
在这一部分上它一直在破裂:
WorkRng.Cells(l, 1).Hyperlink.Add Anchor:=WorkRng.Cells(l, 1), _
Address:=addr, _
TextToDisplay:=CStr(WorkRng.Cells(i, 1).Value)
任何建议都会很有帮助。