K
ks
I am trying to update hyperlinks via VBA after I added a hyperlink base to
the excel file properties. I can't figure out why the following code breaks
when I try to assign cellValue for the first time.
====================
Sub SetHyperlinks()
Dim r, c, z As Integer
Dim hyp As Hyperlink
Dim cellValue As Variant
Worksheets("LOG").Select
c = Application.InputBox(prompt:="Enter the column that contains the
hyperlinks to set:")
r = Application.InputBox(prompt:="Enter the row to set to #1:")
z = Application.InputBox("How many hyperlinks to create:")
z = z + r
Do While r <= z
cellValue = ActiveSheet.Cells(r, c).Value ** Object-defined error
here **
If IsNull(cellValue) Then cellValue = " "
ActiveSheet.Hyperlinks.Add Anchor:=ActiveSheet.Cells(r, c),
Address:="Num-" & r & ".pdf", TextToDisplay:=cellValue
r = r + 1
Loop
End Sub
===============
Thanks for any help!
the excel file properties. I can't figure out why the following code breaks
when I try to assign cellValue for the first time.
====================
Sub SetHyperlinks()
Dim r, c, z As Integer
Dim hyp As Hyperlink
Dim cellValue As Variant
Worksheets("LOG").Select
c = Application.InputBox(prompt:="Enter the column that contains the
hyperlinks to set:")
r = Application.InputBox(prompt:="Enter the row to set to #1:")
z = Application.InputBox("How many hyperlinks to create:")
z = z + r
Do While r <= z
cellValue = ActiveSheet.Cells(r, c).Value ** Object-defined error
here **
If IsNull(cellValue) Then cellValue = " "
ActiveSheet.Hyperlinks.Add Anchor:=ActiveSheet.Cells(r, c),
Address:="Num-" & r & ".pdf", TextToDisplay:=cellValue
r = r + 1
Loop
End Sub
===============
Thanks for any help!