Forum Discussion

narayanareddy's avatar
narayanareddy
Copper Contributor
Jul 07, 2023
Solved

How to have Hpyer link url copied from one cell to another cell with formula

Dear all, I have a requirement to copy excel hyperlink urls in group of cells under one column to another column of cells with a formula. The hyperlink on the cell has a display name and when click ...
  • HansVogelaar's avatar
    Jul 07, 2023

    narayanareddy 

    In Excel for Windows or Mac, you can create a custom VBA function:

    • Press Alt+F11 to activate the Visual Basic Editor.
    • Select Insert > Module.
    • Copy the code listed below into the module.
    • Switch back to Excel.
    • With a hyperlink in A1, the formula =GetURL(A1) will return the URL of the hyperlink.
    • Save the workbook as a macro-enabled workbook (*.xlsm).
    • Make sure that you allow macros when you open the workbook.
    Function GetURL(cell As Range) As String
        GetURL = cell.Hyperlinks(1).Address
    End Function

     

Resources