SOLVED

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

Copper Contributor

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 on the display name then it redirects to the link url. So, I just need to extract automatically the hyperlink url with formulas.

Please share your ideas or thoughts on how to extract hyperlink url from one cell to another cell with formula automatically. Thank you for your help and support.

 

Best Regards,

Narayana Reddy

2 Replies
best response confirmed by Narayana Reddy (Copper Contributor)
Solution

@Narayana Reddy 

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_0-1688724818502.png

 

Thank you so much, it is working.
1 best response

Accepted Solutions
best response confirmed by Narayana Reddy (Copper Contributor)
Solution

@Narayana Reddy 

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_0-1688724818502.png

 

View solution in original post