I have the following code that extracts a hyperlink from a cell and then moves it to an adjacent cell. My goal is to be able to specify multiple columns and the exact column the cells should move to.
As you can see, the code is taking the hyperlink value from columns B1 to B2000 and copying the hyperlink value to column C (cll.Column + 1), but I would like to specify the exact column I want to copy the hyperlink to.
For example: I want all hyperlinks to copy from B to G; D to F; and E to H.
Sub hyper()
Dim sht As Worksheet: Set sht = Worksheets("Sheet1")
Dim cll As Range
For Each cll In sht.Range("B2:B2000")
If cll.Hyperlinks.Count > 0 Then
sht.Cells(cll.Row, cll.Column + 1).Value = cll.Hyperlinks(1).Address
End If
Next cll
msgbox "The macro has completed running"
End Sub
I don't much about VBA macros so any help is appreciated. Thank you very much! ~Adam