What I am trying to do is assign all cells in a range a hyperlink defined by the content of each cell in the range, i.e the hyperlink of A1 is the value of A1.
Public Sub Test()
Dim a1 As Range
Dim b1 As Range
Set a1 = Range(Sheets("sheet1").Cells(i, 2), Sheets("sheet1").Cells(i, 5))
For i = 1 To 1000
If InputRange.a1.Hyperlinks.Count > 0 Then
OutputRange.a1.Hyperlinks.Add Anchor:=a1, _
Address:=InputRange.a1.Hyperlinks(1).Address
End If
Next i
End Sub
I have a large number of cells populated with text that represent links.
For example:
a1 value is "www.msn.com"
a2 value is "www.google.com"
.
.
a10 value is "www.facebook.com"
I would like to assign to each cell a hyperlink to get something like:
sheet1.cells(1,1).Address:="http://www.msn.com" , TextToDisplay:="www.msn.com"
sheet1.cells(1,2).Address:="http://www.google.com" , TextToDisplay:="www.google.com"
.
.
.
sheet1.cells(1,2).Address:="http://www.facebook.com" , TextToDisplay:="www.facebook.com"
Public Sub Test()
Dim a1 As Range
Dim b1 As Range
Set a1 = Range(Sheets("sheet1").Cells(i, 2), Sheets("sheet1").Cells(i, 5))
For i = 1 To 1000
If InputRange.a1.Hyperlinks.Count > 0 Then
OutputRange.a1.Hyperlinks.Add Anchor:=a1, _
Address:=InputRange.a1.Hyperlinks(1).Address
End If
Next i
End Sub
I have a large number of cells populated with text that represent links.
For example:
a1 value is "www.msn.com"
a2 value is "www.google.com"
.
.
a10 value is "www.facebook.com"
I would like to assign to each cell a hyperlink to get something like:
sheet1.cells(1,1).Address:="http://www.msn.com" , TextToDisplay:="www.msn.com"
sheet1.cells(1,2).Address:="http://www.google.com" , TextToDisplay:="www.google.com"
.
.
.
sheet1.cells(1,2).Address:="http://www.facebook.com" , TextToDisplay:="www.facebook.com"