I am creating simple hyperlink for a range of values as they are in text in original template. How do you do this in VBA? Also how do you do the if statement if you want put it as the if contains pattern like "http://".
The following does not work and I get errors.
Sub Convert_To_Hyperlinks()
Dim Cell As Range
Dim rng As Range
Dim ws1 As Worksheet
Set rng = Range("E5:E10")
Set ws1 = Sheets("Sheet1")
For Each Cell In rng
If Cell <> "" Then
ws1.Hyperlinks.Add Anchor:=ws1.Cell, Address:=ws1.Cell.Value, ScreenTip:="", TextToDisplay:=ws1.Cell
End If
Next Cell
End Sub
Aucun commentaire:
Enregistrer un commentaire