How to extract hyperlink from Excel


If you have a list of items in an excel sheet and want to extract the hyperlink from each of this fields use the below method to do it.

First Just Copy the below formula

Function HyperLinkText(pRange As Range) As String
Dim ST1 As String
Dim ST2 As String
If pRange.Hyperlinks.Count = 0 Then
   Exit Function
End If
ST1 = pRange.Hyperlinks(1).Address
ST2 = pRange.Hyperlinks(1).SubAddress
If ST2 <> "" Then
   ST1 = "[" & ST1 & "]" & ST2
End If
HyperLinkText = ST1
End Function

To use this press Alt+F11 click on Insert then Module and paste the above code

Now just come to the excel sheet and In the next cell just type

=HyperLinkText(which cell u want to link)

2 comments:

Unknown said...
This comment has been removed by the author.
Anonymous said...

Great tip. Another good article:

Excel range formula

Post a Comment