tags:

views:

28

answers:

1

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(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
A: 

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

Crispy