How to extract a URL from Hyperlink text – Excel 2007

Posted: November 18, 2012 in Uncategorized

You need this code:
Function HLink(rng As Range) As String
If rng.Hyperlinks.Count Then HLink = rng.Hyperlinks(1).Address
End Function

This then works in the field
Then use: =HLink(B3) in the cell

For those of you unfamiliar with VBA take these simple steps:

  1. Copy the sample code that you want to use
  2. Open the workbook in which you want to add the code
  3. Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
  4. Choose Insert | Module
  5. Where the cursor is flashing, choose Edit | Paste

Vwala!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s