开发者

Print a range of hyperlinks

开发者 https://www.devze.com 2023-01-05 00:18 出处:网络
How can I get this to print the hyperlinks files found in columns \"D:E\" by selecting the rows in column \"A\"

How can I get this to print the hyperlinks files found in columns "D:E" by selecting the rows in column "A"

Sub Print_Hyperlinks()

    Dim rng     As Range
    Dim row     As Range
    Dim cell    As Range
    Dim LastRow As Long


    LastRow = Range("A2").End(x开发者_运维知识库lDown) '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


YOu need to reference the last row not the data therein i.e. replace

LastRow = Range("A2").End(xlDown) 'Print only selected rows in "A" with LastRow = Range("A2").End(xlDown).row 'Print only selected rows in "A"

Chris

0

精彩评论

暂无评论...
验证码 换一张
取 消