Pages

Saturday, June 26, 2010

UDF to Extract Hyperlink Address from Cell


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

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

Download Working File


Steps to Use

  • Copy the below code
  • Press Alt+F11 to open VBA editor
  • Paste it in any public module or module 1
  • For example you want to extract Hyperlink from cell A1 in Cell B1 . In B1 = hyperlink_extcell(A1)

No comments:

Post a Comment