Forum Discussion

KB7GP's avatar
KB7GP
Copper Contributor
Nov 22, 2022

HYPERLINK

Is there a process to select a column of web addresses and convert or activate them as hyperlinks?

Dave

4 Replies

  • KB7GP 

    To convert text values to hyperlinks, select the cells with web addresses and run the following macro:

    Sub Convert2Hyperlinks()
        Dim rng As Range
        Application.ScreenUpdating = False
        For Each rng In Selection
            ActiveSheet.Hyperlinks.Add Anchor:=rng, Address:=rng.Value
        Next rng
        Application.ScreenUpdating = True
    End Sub
    • KB7GP's avatar
      KB7GP
      Copper Contributor

      HansVogelaar 

      I copied and pasted your code into a macro on my excel spreadsheet. I could not get it to work. It may very well be my ignorance using macros within any of the Office portfolios. I can normally do programming if I know/understand the code words and their actions. My 76-year-old brain is slow at soaking up new information AND retaining it.

      Thank you for your suggestion... I will try again after I research macros, their use, and their incorporation. Is the software Visual Basic? It looks a lot like python however, I don't recognize the reserved words and functions. Are they special to MS Excel?

      ~Dave

      • KB7GP 

        The code is VBA (Visual Basic for Applications), the programming language in most Office applications. The version for Excel has special objects for Excel.

        To create the macro:

        Select File > Options.

        Select Customize Ribbon.

        In the list of Main Tabs on the right. scroll down and tick the check box for Developer.

        Click OK.

        You now have a new tab in the ribbon: Developer.

        Activate this tab.

        Click 'Visual Basic'.

        This activates the Visual Basic Editor.

        Select Insert > Module.

        Copy the code that I posted into the module window.

        You can now close the Visual Basic Editor.

        Back in Excel. select the range you want to process.

        On the Developer tab of the ribbon, click Macros.

        Select Convert2Hyperlinks, then click Run.

Resources