Forum Discussion
Cobranack
Jan 21, 2024Copper Contributor
Extracting URL from hyperlink and making it automatic
Function URL(Hyperlink As Range)
URL = Hyperlink.Hyperlinks(1).Address
End Function Hello, The VBA code in the first image allows me to use =URL() to extract the URL. I am t...
Rodrigo_
Jan 22, 2024Steel Contributor
Cobranack
here's an example VBA code that will automatically update the Column B whenever there's a new added hyperlink in column A.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Not Intersect(Target, Columns("A")) Is Nothing Then
For Each cell In Target
If cell.Hyperlinks.Count > 0 Then
cell.Offset(0, 1).Value = cell.Hyperlinks(1).Address
End If
Next cell
End If
End Sub