Forum Discussion
narayanareddy
Jul 07, 2023Copper Contributor
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 ...
- Jul 07, 2023
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
HansVogelaar
Jul 07, 2023MVP
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
- narayanareddyJul 07, 2023Copper ContributorThank you so much, it is working.