4

I have an Excel spreadsheet with around 900 cells each of which contains a URL, which I've pasted in from another program.

If I select a cell and hit F2, then hit Enter, Excel adds a hyperlink to the cell, whose Address is the cell contents.

Is there a mechanism in Excel 2010 to repeat this step for my many hundreds of cells, without having to do the F2 Enter step manually?

(I know that I could automate it in AutoHotKey, but I'm hoping not to need to do that)

Clarification: I specifically want to end up with hyperlinks added to my existing cells, rather than creating a second column which contains hyperlinks.

Things I tried:

  1. Creating a temporary extra column, with =Hyperlink(A1) in A2, as per user301746's answer, and then using Paste Special to copy-and-paste first the formatting, and then the value over A1. This appeared to work, in that the cells in A1 etc were shown in blue and underlined, so they looked like hyperlinks, but actually there weren't linked - it had only copied the hyperlink display style.
6

so I found a cheat method to this question, I had the same problem, needed to turn about 4000 cells into hyperlinks

I copied and pasted the entire column into a google sheet, the gsheet automatically turned all links into active links, then I re copied the column from the gsheet and pasted it back into the excel spreadsheet.

| improve this answer | |
  • That’s a nice idea, so long as you are comfortable placing your data in cloud storage, even temporarily. – Clare Macrae Aug 10 '18 at 21:27
  • This worked and was easiest. – Alex S May 6 at 15:28
1

You could use =Hyperlink(A1) in A2 to do what you want, then copy it downwards with the cell fill tool.

Hope that helps.

| improve this answer | |
  • Thanks, but if I understand correctly, that requires me to create an extra column, just for the hyperlinks. My question is how to get the hyperlinks into A1, A2 etc, without creating an extra column. I'll edit my question with more info. – Clare Macrae Feb 20 '14 at 11:40
  • Could you not hide the first column after creation, or copy the cell data (including formatting, no formulae from column 2 into 1 then delete column 2 when done? EDIT: seen your post change – user301746 Feb 20 '14 at 12:39
  • Such a simple solution! – sehummel Jul 23 '15 at 18:33
1

As an alternative to autohotkey it's fairly easy to code in vba. The following code would do what you want for alls the cells in column A starting in row 2.

Sub add_links()
Dim lRow As Long

    With ActiveSheet
        lRow = .Range("A" & .Rows.Count).End(xlUp).Row
        For Each c In .Range("A2:A" & lRow)
            ActiveSheet.Hyperlinks.add anchor:=c, Address:=c.Value
        Next
    End With

End Sub
| improve this answer | |
1

OK, I've found a (slightly ugly) series of steps that at least ends up with hyperlinked text in the original column, using user301746's suggested use of the HYPERLINK function, but with only one column.

  1. Copy all the Excel 2010 cells that contain the URLs
  2. Paste the URLs into Notepad++
  3. In Notepad++, convert all the URLs to Excel HYPERLINK formulae - using the mechanism described in this answer
    1. Control-H to bring up replace dialog
    2. Change the Search Mode to Regular Expression
    3. Enter (http.*) as the search criteria (find any line with http in it, and store in variable \1
    4. Enter =HYPERLINK\(\"\1\"\) as the replace criteria - replace what was found in the previous step with itself contained in HYPERLINK function call
    5. Replace All - now all your link lines are enclosed, any remaining lines must be titles
  4. Copy all the text from Notepad++
  5. Paste it over the original cells in Excel 2010. Now the Excel cell cells will all be hyperlinks, but they won't be formatted to look like hyperlinks
  6. With the pasted cells still selected, click on the Hyperlink style button, in the Styles section of the Home tab of the Ribbon, to make them look like hyperlinks.
| improve this answer | |
0

@gtwebb thank you this was what I needed.

I modified it a bit to add input for which column

Sub add_links_Input_Column()
Dim lRow As Long
Dim ColHead As String

ColHead = InputBox("Enter Column Letter", "Identify Column", [c1].Value)
If ColHead = "" Then Exit Sub

    With ActiveSheet
        lRow = .Range(ColHead & .Rows.Count).End(xlUp).Row
        For Each c In .Range(ColHead & "2:" & ColHead & lRow)
            ActiveSheet.Hyperlinks.Add anchor:=c, Address:=c.Value
        Next
    End With

End Sub
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.