如何通过选择“A”列中的行来打印“D:E”列中的超链接文件
Sub Print_Hyperlinks()
Dim rng As Range
Dim row As Range
Dim cell As Range
Dim LastRow As Long
LastRow = Range("A2").End(xlDown) 'Print only selected rows in "A"
Set rng = Range("D2:E" & LastRow)
For Each row In rng.Rows
For Each cell In row.Cells
Selection.Hyperlinks(1).Follow 'List of Hyperlinks in Column "D"
Selection.Hyperlinks(2).Follow 'List of Hyperlinks in Column "E"
Next cell
Next row
End Sub
答案 0 :(得分:0)
你需要引用最后一行而不是其中的数据,即替换
LastRow =范围(“A2”)。结束(xlDown)'仅打印“A”中的选定行 同 LastRow = Range(“A2”)。End(xlDown).row'仅打印“A”中的选定行
克里斯