Have been already solved:
Had to rework following:
newLink = Range("B" & i).Hyperlinks(1).Address + "#" + Range("B" & i).Hyperlinks(1).SubAddress
Hello guys,
I have made a macro that is copying over hyperlinks from one column to another.
Macro works just fine however hyperlinks contain '#' in the middle of them so lets say:
- Code: Select all
https://website.com/nu#somethingsomething
which makes the macro copy just first part of it i.e.:
- Code: Select all
https://website.com/nu
Any ideas how to make Excel ignore '#' (if possible at all) and copy over entire value of hyperlink?
VBA code:
- Code: Select all
Sub MilestonesHyperlink()
For i = 2 To 62 'Number of rows
If Range("B" & i).Value <> "" And Range("A" & i).Value <> "" Then 'Copy from column B to A
Dim newLink As String
If Range("B" & i).Hyperlinks.Count = 1 Then
newLink = Range("B" & i).Hyperlinks(1).Address
Range("A" & i).Hyperlinks.Add anchor:=Range("A" & i), Address:=Range("A" & i)
Range("A" & i).Hyperlinks(1).Address = newLink
End If
End If
Next i
End Sub
Thanks a lot.