40

In Excel, I have a column of links that display text instead of the actual link.

I actually need the links, is there a way to bulk convert the entire column so that the links are exposed? Otherwise I will have to click on each link, open it in a browser, and copy-and-paste the address...

Also, I'm in Excel 2008 for Mac so it looks like I can't do macros...

5 Answers 5

59

Short answer: you can't automate this without VBA.

Manual

This is on a Windows 7 computer; just replace the shortcuts with their corresponding Mac counterparts.

  1. Highlight a cell with a hyperlink.
  2. Press CTRL+K. This opens the hyperlink dialog box (see image below). Once it opens, you'll find that your cursor is already in the Address field.
  3. Press CTRL+A to highlight the entire URL.
  4. Press CTRL+C to copy it.
  5. Press ESC or Enter to close the Hyperlink dialog box.
  6. Paste the URL somewhere via CTRL + V.

enter image description here

VBA

Here's a VBA solution for those who can use it.

Create a VBA module with the following code:

Public Function GetURL(c As Range) As String
    On Error Resume Next
    GetURL = c.Hyperlinks(1).Address
End Function

To use, enter the following into any cell:

=GetURL(A1)

where A1 contains a hyperlink.

The function at work:

enter image description here

4
  • 16
    That's a great snippet. For those wondering how to add this code to their worksheet... Press Alt + F11 to show the Visual Basic Editor. Then click "Insert -> Module". Paste the code Ellesa provided into the text area and you can then close the VBE and start using the function.
    – BA_Webimax
    Feb 14, 2015 at 15:19
  • I needed a reason to re-learn adding user functions to Excel. A list of 4060 active (embedded) links was the reason. This (Ellesa's) post was the answer. And @BA_Webimax, you even saved me from having to remember HOW to add it. It took me longer to write this comment than to add the function and fix the XLS.
    – Marc
    Mar 16, 2016 at 17:54
  • +30, this is what makes this site great (:
    – jwd
    Aug 8, 2017 at 21:55
  • So I noticed that this snippet doesn't pull any of the anchor reference information so if your URL had a bookmark embedded in it, that was lost. I added a little concatenation to the end to show the "subaddress". GetURL = c.Hyperlinks(1).Address + "#" + c.Hyperlinks(1).SubAddress
    – Mandrake
    Feb 17, 2021 at 0:01
10

This may sounds like a brute force method, but it's the best way I've come up with. (I discovered this page when I had the same question myself an hour ago... you could spend all day looking, but sometimes it's just easier to do it and be done with it.)

1) Copy and paste just the cells containing the hyperlinks to a new spreadsheet.

2) Export the spreadsheet, click "Change File Type," select "Save As Another File Type" and save it as a web page (aka an HTML file).

3) Open the web page in your browser and view the source.

4) Copy and paste the source into an text editor.

5) Using the Find/Replace function of the text editor, remove the leading and trailing text of each hyperlink. (In other words, replace said text with nothing: "") Note that this text should be identical for each hyperlink.

6) You should now have a text file with nothing but hyperlinks. Copy and paste as needed back into your original spreadsheet or use however/wherever you wish.

Edited to state that you can actually export to a separate file that is HTM. Close the file out and reopen it in Excel again and it will solve the problem. The =Hyperlink formula is gone and the links are converted into regular links. This method saved me hours and was dead simple and I didn't have to deal with scripts or formulas or VBA or Macros.

1
  • Save as html > Open with sublime > Ctrl+F XXXX > Find All (Put multiple cursor at every match) > do not select any character but stay at that line and Ctrl +C > Sublime copy line if there isn't any selection > open new txt and Ctrl +P you saved my precious time thanks Feb 8, 2021 at 15:03
7

I use a mac and this worked for me: highlight column you need to convert, on Insert menu, open "Hyperlink". Delete any text that appears in the Display box. It will say "[multiple cells selected]" if your display text is different across cells. Once you click OK, only the links will appear on your worksheet. If you need to convert individual cells rather than an entire column, highlight all cells that you need to convert, right click, select "edit hyperlink" and follow the same steps to delete the text in the Display box.

3
  • Brilliant. Way easier than VBA!
    – Tom Auger
    Feb 16, 2017 at 22:21
  • this is a great tip!!!
    – FFrewin
    Jul 4, 2017 at 11:18
  • 4
    Unfortunately this didn't seem to work for me on Windows (10), Excel (2016).
    – user293098
    Aug 10, 2018 at 3:27
0

I'm sure there is with VBA however in the mean time right click, H, and copy and paste the address into the screen to display box

0

In the years since this question was asked Excel, someone at my firm added this =GetURL(cell) function to our global XLAM file and I thought it was part of base Excel. Here's the VBA...

Public Function GetURL(cell As Range, Optional default_value As Variant) As Variant
      Dim output As Variant
      If (cell.Range("A1").Hyperlinks.Count <> 1) Then
          output = default_value
      Else
          output = cell.Range("A1").Hyperlinks(1).Address
      End If
      GetURL = output
End Function
2
  • 1
    There's no such standard function in any version of Excel I've used, including the current version of Excel for Office 365 (16.0.whatever). It's not mentioned in the built-in help nor is it listed anywhere on Microsoft's support/docs website. Perhaps you have the VBA and just don't know/remember or it's part of another add-in you're using?
    – Brent R.
    Apr 9, 2020 at 17:22
  • Thanks. You are right. I updated the answer to include the VBA. Apr 9, 2020 at 17:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .