How to Copy Hyperlink Targets from a Master Excel Workbook
Question details
The user needs to extract and copy the actual hyperlink URLs from a master workbook into individual desktop copies, rather than just copying the cell's display text.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Users are working with individual desktop copies of a master workbook stored on OneDrive that contains vehicle records and hyperlinks to service manuals.
- Observed behavior
- Standard references and HYPERLINK formulas only copy the displayed cell value or link back to the master workbook, failing to open the original hyperlink destination.
Ensure your Excel workbook is saved as a Macro-Enabled Workbook (.xlsm), as extracting underlying hyperlink addresses requires a custom VBA script.
Use a Custom VBA Function to Extract Hyperlinks
Since standard Excel formulas cannot extract a hyperlink object's address, you must use a VBA User Defined Function (UDF) to retrieve the target URL.
Excel does not natively provide a worksheet formula to pull a cell's underlying hyperlink target. Directly referencing the cell (e.g., =A1) only returns the text displayed in the cell.
By writing a simple VBA script, you can create a custom formula that reads the hyperlink object's address and outputs it as text, which can then be used in a standard HYPERLINK formula.
Press 'Alt + F11' on your keyboard to open the Microsoft Visual Basic for Applications window.
Click on 'Insert' in the top menu bar and select 'Module' from the dropdown to create a blank script window.
Paste a standard UDF code (such as 'Function GetURL(rng As Range) As String') that extracts 'rng.Hyperlinks(1).Address' and save the module.
Return to your worksheet, select a destination cell, and type '=GetURL(A1)' (replacing A1 with the cell containing your master link) to display the raw URL.
Try WPS Office for Seamless Spreadsheet Management
Struggling with complicated Excel workarounds and macro limitations? WPS Office offers a powerful, lightweight, and highly compatible spreadsheet solution that makes handling data and hyperlinks effortless.

Frequently Asked Questions
Why doesn't the HYPERLINK function copy the target from another cell?
The HYPERLINK function requires a text string URL to work. When you reference another cell that contains a hyperlink object, Excel only passes the display text of that cell, not the underlying URL, causing the function to fail.
Can I manually copy and paste hyperlinks between workbooks?
Yes, using standard copy and paste shortcuts (Ctrl+C and Ctrl+V) will duplicate the cell exactly, preserving the original hyperlink destination. However, this is a manual process and cannot be automated with standard formulas.
Why do my macro-extracted hyperlinks show a OneDrive web URL instead of a local path?
When a workbook is synced via OneDrive, Office often treats paths as SharePoint/OneDrive web URLs (HTTPS) rather than local C: drive directories. You may need additional VBA string manipulation to convert the HTTPS path back to a local environmental path.




