• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

UDF to extract hyperlink address from a cell

If you want to extract hyperlink address from a cell. Try this udf-

[pre]
Code:
Function hyperlink_extcell(cell As Range)
If cell.Hyperlinks.Count > 0 Then
hyperlink_extcell = cell.Hyperlinks(1).Address
Else
hyperlink_extcell = "Hyperlink Not Found"
End If
End Function
[/pre]
 
Hi Ashish,

Above UDF will work only if the hyperlink is external. I'd suggest it should look for empty address property like below so that it will internal (within workbook) addresses as well.

[pre]
Code:
Function hyperlink_extcell(cell As Range)
If cell.Hyperlinks.Count > 0 Then
If Not cell.Hyperlinks(1).Address = vbNullString Then
hyperlink_extcell = cell.Hyperlinks(1).Address
Else
hyperlink_extcell = cell.Hyperlinks(1).SubAddress
End If
Else
hyperlink_extcell = "Hyperlink Not Found"
End If
End Function
[/pre]
 
Back
Top