347

I have a column in excel, wherein I have all the website url values. My question is I want to turn the url values to active links. There are about 200 entries in that column with different urls in all cells. Is there a way I can create active hyperlinks to all the cells without writing a macro.

hawbsl
  • 15,313
  • 25
  • 73
  • 114
developer
  • 5,178
  • 11
  • 47
  • 72

23 Answers23

375

If you don't want to make a macro and as long as you don't mind an additional column, then just create a new column alongside your column of URLs.

In the new column type in the formula =HYPERLINK(A1) (replacing A1 with whatever cell you are interested in). Then copy the formula down the rest of the 200 entries.

NOTE: This solution does not work if the cell A1 contains a string longer than 255 characters. It results in a #VALUE! error

John Rocha
  • 1,656
  • 3
  • 19
  • 30
hawbsl
  • 15,313
  • 25
  • 73
  • 114
  • 5
    If my column A contains 200 link values, is it possible to write a formula that would hyperlink the 200 values and rewrite it in column A, instead of creating a new column? – developer Apr 07 '10 at 20:50
  • 1
    Excellent! The best thing is, this step is so simple that I can pass CSV files to a layperson and he can generate URLS from it easily. – Cardin May 25 '15 at 01:29
  • 4
    To make it so it's one column just copy the hyperlink column and "paste value" into whichever column you want to keep. – Mike May 04 '17 at 17:52
  • 1
    This should be accepted answer, since it solves most of the use cases. – Jay Jan 15 '18 at 12:27
  • 1
    Hide the raw column that's not a hyperlink – RickAndMSFT Sep 28 '18 at 01:48
  • simplest way I found is , the Excel's self function =HYPERLINK(cell address,"HyperlinkName") – Syed Haseeb Jan 06 '21 at 04:16
  • This is amazing. Although on small question. After generating the new column, if I delete the column with hyperlinks I get a "reference error". Is there a way to avoid this? Is there a way to "rasterize" like you do in photoshop? – theprogrammer Jan 11 '21 at 03:36
  • =KÖPRÜ(A1) in Turkish, if there is anyone ever wonder – Abbas Elmas Jun 26 '23 at 00:01
112

Create the macro as here:

On the Tools menu in Microsoft Excel, point to Macro, and then click Visual Basic Editor. On the Insert menu, click Module. Copy and paste this code into the code window of the module. It will automatically name itself HyperAdd.

Sub HyperAdd()

    'Converts each text hyperlink selected into a working hyperlink

    For Each xCell In Selection
        ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=xCell.Formula
    Next xCell

End Sub

When you're finished pasting your macro, click Close and Return to Microsoft Excel on the File menu.

Then select the required cells and click macro and click run.

NOTE Do NOT select the whole column! Select ONLY the cells you wish to be changed to clickable links else you will end up in a neverending loop and have to restart Excel! Done!

Neil
  • 5,762
  • 24
  • 36
Steve Keenan
  • 1,137
  • 1
  • 7
  • 5
  • 2
    Add Dim xCell As Range if you are using the explicit option. +1 for a solution that changes the cell (as asked) and providing the code that does it. – Praesagus Dec 22 '14 at 23:52
  • This worked well for me, granted I had about 50,000 links in a spread sheet that needed updating and had to do it in chunks or excel would crash. – ATek Jun 15 '15 at 22:06
  • 2
    To make email addresses into hyperlinks, change `Address:=xCell.Formula` to `Address:="mailto:" & xCell.Formula` – Danny Beckett Oct 21 '15 at 21:30
  • Also, for URLs not starting with `http://` this needs to be added (use the above change, but substitute `mailto:` with `http://`. Otherwise the hyperlinks don't work. – Danny Beckett Oct 21 '15 at 21:55
  • This worked great! One note for others. If you're using Excel 2010 like I am and an Excel dummy like I am, you first have to enable the developer ribbon tab. Right click on the ribbon interface, select customize the ribbon ... And on the main tabs make sure "Developer" is selected. Then continue to follow the instructions as above, worked great for me. – Eric Van Bezooijen Jul 21 '16 at 00:18
  • Worked smoothly. Is there any way to improve the cycle so that loop only trough cell with a value? – Daniele D. Nov 23 '16 at 10:06
  • On Excel 2016/Mac I had to use `ActiveWorkbook.ActiveSheet.Hyperlinks.Add` rather than just `ActiveSheet.Hyperlinks.Add`. Thanks! – Dale Jan 09 '17 at 13:59
  • I get runtime error 1004 "Application-defined or object-defined error". – Tomáš Zato May 26 '17 at 14:26
  • 1
    Works great. FYI Excel 2016 has a limit of 66,530 hyperlinks per worksheet, so expect an eventual run-time error if you exceed that. https://support.office.com/en-us/article/Excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3 – Christopher O'Brien Jun 01 '17 at 21:46
  • This works, but in my case if I save the file, close it, than it takes forever to open it again. Any suggestion on this side ? – Thomas Feb 28 '22 at 20:28
39

Pretty easy way for rather short lists:

  1. Double click on the box where the url is
  2. Enter

You have your link ;)

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
user3210679
  • 417
  • 4
  • 2
26

Here's a way I found. I'm on a Mac using Excel 2011. If column B had the text values you want to be hyperlinks, put this formula in the cell C1 (or D1 or whatever as long as it's a free column): =HYPERLINK(B1,B1) This will insert a hyperlink with the location as the link text and the "friendly name" as the link text. If you have another column that has a friendly name for each link, you could use that too. Then, you could hide the text column if you didn't want to see it.

If you have a list of IDs of something, and the urls were all http://website.com/folder/ID, such as:

A1  | B1
101 | http://website.com/folder/101
102 | http://website.com/folder/102
103 | http://website.com/folder/103
104 | http://website.com/folder/104

you could use something like =HYPERLINK("http://website.com/folder/"&A1,A1) and you wouldn't need the list of urls. That was my situation and worked nicely.

According to this post: http://excelhints.com/2007/06/12/hyperlink-formula-in-excel/ this method will work in Excel 2007 as well.

WizzleWuzzle
  • 145
  • 1
  • 13
Marty
  • 588
  • 1
  • 7
  • 15
22

OK, here's a hokey solution, but I just can't figure out how to get Excel to evaluate a column of URLs as hyperlinks in bulk.

  1. Create a formula, ="=hyperlink(""" & A1 & """)"
  2. Drag down
  3. Copy new formula column
  4. Paste Special Values-only over the original column
  5. Highlight column, click Ctrl-H (to replace), finding and replacing = with = (somehow forces re-evaluation of cells).
  6. Cells should now be clickable as hyperlinks. If you want the blue/underline style, then just highlight all cells and choose the Hyperlink style.

The hyperlink style alone won't convert to clickable links, and the "Insert Hyperlink" dialog can't seem to use the text as the address for a bunch of cells in bulk. Aside from that, F2 and Enter through all cells would do it, but that's tedious for a lot of cells.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Indolent Coder
  • 708
  • 3
  • 5
20

If adding an extra column with the hyperlinks is not an option, the alternative is to use an external editor to enclose your hyperlink into =hyperlink(" and "), in order to obtain =hyperlink("originalCellContent")

If you have Notepad++, this is a recipe you can use to perform this operation semi-automatically:

  • Copy the column of addresses to Notepad++
  • Keeping ALT-SHIFT pressed, extended your cursor from the top left corner to the bottom left corner, and type =hyperlink(". This adds =hyperlink(" at the beginning of each entry.
  • Open "Replace" menu (Ctrl-H), activate regular expressions (ALT-G), and replace $ (end of line) with "\). This adds a closed quote and a closed parenthesis (which needs to be escaped with \ when regular expressions are activated) at the end of each line.
  • Paste back the data in Excel. In practice, just copy the data and select the first cell of the column where you want the data to end up.
Antonio
  • 19,451
  • 13
  • 99
  • 197
  • Great answer. This is the only way to go if you do not want any extra columns. The solution can be used for any kind of editor or programming language (not just Notepad++). In Excel 2010 this does create clickable links, but I had to manually apply the "hyperlink formatting style" to really make them look like links (i.e. blue underlined). – absurd Mar 29 '18 at 09:58
  • **Note:** This does not require notepad++ ... just for the sake of clarity, you can do this with any text editor. The trick is to just wrap each line with `=hyperlink("__linecontentgoeshere__")` ... for those who may be misled by the mention of notepad++ – dreftymac Apr 26 '19 at 23:10
  • @dreftymac This gives a recipe of how to do this *almost* automatically, not editing line by line. It leverages Notepad++ capability to extend the cursor on multiple lines and support of regular expressions; other editors might have similar functions. I am clarifying at the beginning of my answer what is the intended result, that should get rid of the misunderstanding. – Antonio Apr 29 '19 at 21:12
  • 1
    **//I am clarifying at the beginning of my answer what is the intended result//** Thank you for emphasizing your point. I was not criticizing your answer, just making it a bit more clear for those who might not know anything about Notepad++, and may not realize it is simply one of *many* text editors out there that can do this kind of thing. I know **you** realize that, but not everyone does. – dreftymac Apr 30 '19 at 00:29
  • 1
    You can also compose the formula in Excel with `="=HYPERLINK("""&A1&""")"` (assuming the URL is in A1). Then copy the result to Notepad and back to Excel (there might be a better way). Now you have working hyperlinks - you can apply the hyperlink style from the Styles panel to them to get the blue underlined look. If you have the link label in column B, you can use this formula: `="=HYPERLINK("""&A1&""";"""&B1&""")"`. – Jonáš Jančařík Jun 26 '19 at 12:52
16

I shocked Excel didn't do this automatically so here is my solution I hope would be useful for others,

  1. Open this on your Chrome or Firefox

data:text/html,<button onclick="document.write(document.body.querySelector('textarea').value.split('\n').map(x => '<a href=\'' + x + '\'>' + x + '</a>').join('<br>'))">Linkify</button><br><textarea></textarea>

  1. Copy the whole column to clipboard
  2. Paste the column on the page you just opened on the browser and press "Linkify"
  3. Copy the result from the tab to the the column on Excel

Instead step two, you can use the below page, first, click on "Run code snippet" then paste the column on it

<button onclick="document.write(document.body.querySelector('textarea').value.split('\n').map(x => '<a href=\'' + x + '\'>' + x + '</a>').join('<br>'))">Linkify</button><br><textarea></textarea>
Ebrahim Byagowi
  • 10,338
  • 4
  • 70
  • 81
7

This method works for me using the hyperlink function:

=HYPERLINK("http://"&B10,B10)

Where B10 is the cell containing the text version of the URL (in this example).

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Wasabihound
  • 71
  • 1
  • 1
  • =HYPERLINK("http://"&B10,B10) didn't work in my Excel 2013, however =HYPERLINK("http://"&B10) DID work. – agibsen May 08 '13 at 09:18
6
  1. Create a temporary new column of hyperlinks using formula =HYPERLINK()
  2. Copy that column into Microsoft Word (copy to clipboard only after Word is running).
  3. Copy everything in the new word document (ctrl+a, then ctrl+c).
  4. Paste into Excel, replacing the original column of text. Delete the temporary column with the formula.
Vin
  • 1,975
  • 5
  • 27
  • 34
5

With Excel 2007 on Windows, I found these steps simplest;

  1. Select cells with the non-active URLs
  2. Copy
  3. Paste as hyperlink
Matt
  • 74,352
  • 26
  • 153
  • 180
Clumzoid
  • 59
  • 1
  • 1
  • 1
    In later version (I'm using Office 2011), this isn't working - I just get a hyperlink to a desktop file (this one), not to the url shown in the cell. e.g. file://localhost/Users/xxxx/Desktop/Blahblahblah File Name.xlsx - Sheet1!A2 – Dannid Jan 30 '14 at 20:27
3

I found that none of the methods here worked if the hyperlink did not include http:// as they linked to local locations.

I also wanted to fool-proof the script as the users would not be able to maintain it themselves and I would not be available.

It will only run on cells in a selected range if they contain a dot and no spaces. It will only run for up to 10,000 cells.

Sub HyperAdd()
Dim CellsWithSpaces As String
    'Converts each text hyperlink selected into a working hyperlink
    Application.ScreenUpdating = False
    Dim NotPresent As Integer
    NotPresent = 0

    For Each xCell In Selection
        xCell.Formula = Trim(xCell.Formula)
        If xCell.Formula = "" Or InStr(xCell.Formula, ".") = NotPresent Then
        'Do nothing if the cell is blank or contains no dots
        Else
            If InStr(xCell.Formula, " ") <> 0 Then
                CellsWithSpaces = CellsWithSpaces & ", " & Replace(xCell.Address, "$", "")
                 GoTo Nextxcell
            End If

            If InStr(xCell.Formula, "http") <> 0 Then
                Hyperstring = Trim(xCell.Formula)
            Else
                Hyperstring = "http://" & Trim(xCell.Formula)
            End If

            ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=Hyperstring

        End If
        i = i + 1
        If i = 10000 Then Exit Sub
Nextxcell:
      Next xCell
    If Not CellsWithSpaces = "" Then
        MsgBox ("Please remove spaces from the following cells:" & CellsWithSpaces)
    End If
Application.ScreenUpdating = True
End Sub
Cassiopeia
  • 313
  • 1
  • 4
  • 16
  • 1
    Thanks, this worked for e-mail addresses within an excel document - I've tried a few other different methods but this was the one that worked although I needed to change the http:// to mailto: – bawpie Aug 21 '19 at 13:09
3

For me I just copied the entire column which has the URLs in text format into another application (say Evernote), and when they were pasted there they became links, and then I just copied them back into Excel.

The only thing here is you need to make sure the data you copy back lines up with the rest of the columns.

AbuMariam
  • 3,282
  • 13
  • 49
  • 82
3

For anyone landing here with Excel 2016, you can simply highlight the column, then click the Hyperlink tab located on the Home ribbon in the Styles box.

enter image description here

Edit: Unfortunately, this only updates the cell style, not the function.

jGroot
  • 600
  • 4
  • 10
2

Try this:

=HYPERLINK("mailto:"&A1, A1)

Replace A1 with your text of email address cell.

1

You can insert the formula =HYPERLINK(<your_cell>,<your_cell>) to the adjacent cell and drag it along all the way to the bottom. This will give you a column with all the links. Now, you can select your original column by clicking on the header, right-click, and select Hide.

th3an0maly
  • 3,360
  • 8
  • 33
  • 54
1

If you copy the text contents into a new column and use:

=HYPERLINK("http://"&B10,B10) 

on your original column. Then use the $ for the column so it looks like this:

=HYPERLINK("http://"&$B10,$B10)

That's the only way it worked for me on Excel 2010 on Windows 7. You can copy down the formula.

Ruskin
  • 5,721
  • 4
  • 45
  • 62
vanesaqy
  • 11
  • 1
1

Put the URLs into an HTML table, load the HTML page into a browser, copy the contents of that page, paste into Excel. At this point the URLs are preserved as active links.

Solution was proposed on http://answers.microsoft.com/en-us/mac/forum/macoffice2008-macexcel/how-to-copy-and-paste-to-mac-excel-2008-a-list-of/c5fa2890-acf5-461d-adb5-32480855e11e by (Jim Gordon Mac MVP)[http://answers.microsoft.com/en-us/profile/75a2b744-a259-49bb-8eb1-7db61dae9e78]

I found that it worked.

I had these URLs:

https://twitter.com/keeseter/status/578350771235872768/photo/1 https://instagram.com/p/ys5ASPCDEV/ https://igcdn-photos-g-a.akamaihd.net/hphotos-ak-xfa1/t51.2885-15/10881854_329617847240910_1814142151_n.jpg https://twitter.com/ranadotson/status/539485028712189952/photo/1 https://instagram.com/p/0OgdvyxMhW/ https://instagram.com/p/1nynTiiLSb/

I put them into an HTML file (links.html) like this:

<table>
<tr><td><a href="https://twitter.com/keeseter/status/578350771235872768/photo/1">https://twitter.com/keeseter/status/578350771235872768/photo/1</a></td></tr>
<tr><td><a href="https://instagram.com/p/ys5ASPCDEV/">https://instagram.com/p/ys5ASPCDEV/</a></td></tr>
<tr><td><a href="https://igcdn-photos-g-a.akamaihd.net/hphotos-ak-xfa1/t51.2885-15/10881854_329617847240910_1814142151_n.jpg">https://igcdn-photos-g-a.akamaihd.net/hphotos-ak-xfa1/t51.2885-15/10881854_329617847240910_1814142151_n.jpg</a></td></tr>
<tr><td><a href="https://twitter.com/ranadotson/status/539485028712189952/photo/1">https://twitter.com/ranadotson/status/539485028712189952/photo/1</a></td></tr>
<tr><td><a href="https://instagram.com/p/0OgdvyxMhW/">https://instagram.com/p/0OgdvyxMhW/</a></td></tr>
</table>

Then I loaded the links.html into my browser, copied, pasted into Excel, and the links were active.

Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113
1

Thank you Cassiopeia for code. I change his code to work with local addresses and made little changes to his conditions. I removed following conditions:

  1. Change http:/ to file:///
  2. Removed all type of white space conditions
  3. Changed 10k cell range condition to 100k

Sub HyperAddForLocalLinks()
Dim CellsWithSpaces As String
    'Converts each text hyperlink selected into a working hyperlink
    Application.ScreenUpdating = False
    Dim NotPresent As Integer
    NotPresent = 0

    For Each xCell In Selection
        xCell.Formula = Trim(xCell.Formula)
            If InStr(xCell.Formula, "file:///") <> 0 Then
                Hyperstring = Trim(xCell.Formula)
            Else
                Hyperstring = "file:///" & Trim(xCell.Formula)
            End If

            ActiveSheet.Hyperlinks.Add Anchor:=xCell, Address:=Hyperstring

        i = i + 1
        If i = 100000 Then Exit Sub
Nextxcell:
      Next xCell
    Application.ScreenUpdating = True
End Sub
Junaid
  • 111
  • 1
  • 10
  • Working perfectly, I made ~7000 hyperlink in just couple of seconds. :) Thank you Cassiopeia. – Junaid Nov 23 '16 at 07:20
  • why did you define `NotPresent`? – Steffen Roller Dec 04 '18 at 19:16
  • I just copied above code from prior Cassiopeia's reply. And modified it as much as I understood it. So I don't know if NotPresent is necessary or not. But my modified code works perfectly fine. – Junaid Dec 06 '18 at 13:49
1

I had a list of numbers that feed into url's I want hotlinked. For example I have Column A with question numbers (i.e., 2595692, 135171) and I want to turn these question numbers into hotlinks and to display only the question numbers.

So I built a text-only hyperlink pointing to Column A, and copied it down for all my question numbers:

="=HYPERLINK("&"""http""&"":"""&""&"&"&"""//stackoverflow.com/questions/"&A1&""""&","&A1&")"

Then I copy - paste value this column of text hyperlinks to another column.

You end up with a column of text that looks like the following:

=HYPERLINK("http"&":"&"//stackoverflow.com/questions/2595692",2595692)

Then I selected these pasted items and ran the F2Entry Macro that follows:

Sub F2Enter()
Dim cell As Range
Application.Calculation = xlCalculationManual
For Each cell In Selection
    cell.Activate
    cell = Trim(cell)
Next cell
Application.Calculation = xlCalculationAutomatic
EndSub

I then deleted the text entry column and Column A.

I ended up with a single column of hotlinked question numbers:

2595692

135171

etc.

Cheers

RKO
  • 161
  • 10
1

On Mac, a dead easy way to do it is select your entire spreadsheet in Excel, copy, launch Numbers, paste, then select all, copy, and paste back into Excel.

mrzzmr
  • 695
  • 1
  • 7
  • 6
  • If your data set is small maybe. I only had 6,400 rows and 10 cols and it took 5 mins to paste it - and it was all smashed into the first column. (Took 3 sec to copy from Google Sheets into Excel.) Numbers has always been a slow, sad experience any time I have tried to use it. – Neil Monroe Mar 29 '22 at 21:40
  • I just did it for a spreadsheet with 750 rows and 50 columns, and the paste into Numbers takes about 20 seconds, copy and paste back into Excel another 30 seconds. Columns are fine, not smashed into one. If only one column has URLs, just copy and paste that one column, my 750 rows took about a second. – mrzzmr Apr 29 '22 at 20:49
  • The fact that all the other answers are so convoluted, this is actually not terrible, especially for the 25% or so Users that are using macOS. I appreciate you posting this as an answer. Thank you. – Joshua Pinter Mar 14 '23 at 03:49
-2

Easiest way here

  • Highlight the whole column
  • click ''insert''
  • click ''Hyperlink''
  • click ''place in this document''
  • click ok
  • thats all
vfclists
  • 19,193
  • 21
  • 73
  • 92
-4

The simplest way in Excel 2010: Select the column with the URL text, then select Hyperlink Style from the Home tab. All URLs in the column are now hyperlinks.

Also double clicking each cell at the end of the URL text and adding a blank or just enter will also produce a hyperlink. Similar to the way you have to create URL links in MS Outlook emails.

Ron
  • 9
  • 2
-5

There is a very simple way to do this. Create one hyperlink, and then use the Format Painter to copy down the formatting. It will create a hyperlink for every item.

Daniel
  • 1