Excel Find and Replace Hyperlink Paths?

How-to basics · Updated November 3, 2026

Excel Find and Replace Hyperlink Paths?

Excel Find and Replace can change a path when it appears as text in a cell or inside a HYPERLINK formula, but it generally does not edit the destination stored in a hyperlink inserted through the ribbon. For those links, change the address in the Edit Hyperlink dialog, or use VBA for a carefully checked bulk update.

What Find and Replace can—and cannot—change

A hyperlink has two parts that are easy to confuse: the text shown in the cell and the destination that opens when someone clicks it. The displayed text might be a filename such as “Open report,” while the destination is a long web address or file path. Replacing the visible text does not necessarily change the destination, and changing a destination does not necessarily change the visible text.

In Excel for Microsoft 365 on Windows, Ctrl+H opens Find and Replace. It searches and replaces cell contents and, when the search is set to look in formulas, formula text. It is not a general-purpose editor for the address property of every inserted hyperlink. If you use Replace All on a cell that merely displays a friendly label, the label may change while the link still points to its original location.

First identify how the link was created. A cell containing a HYPERLINK formula stores the destination in its formula, so replacing a path within that formula can work. A link added with Insert > Link, or with Ctrl+K, is usually stored as a hyperlink attached to the cell; its address must be edited as a hyperlink rather than treated as ordinary cell text.

Identify the kind of hyperlink

Select the cell and look at the formula bar. If it begins with =HYPERLINK(, the link is formula-based. If the formula bar shows only a label such as “Open report,” while clicking the cell opens a destination, it is likely a regular inserted hyperlink. Right-clicking the cell and choosing Edit Hyperlink is another useful check: if the dialog shows the link address, Excel is treating it as a hyperlink object.

There are also internal links, such as links to another worksheet or a named range, and links to email addresses. These may have an address, an internal subaddress, or both. Before replacing anything, decide which part should change. A file’s path can be in the address, while a worksheet name or cell reference can be stored separately as a subaddress.

  • Formula link: the destination appears within a cell formula and may be changed with Find and Replace.
  • Inserted link: the destination is attached to a cell or object; edit the hyperlink itself.
  • Internal link: the destination may be a sheet, range, or workbook location rather than a folder path.

Replace a path in HYPERLINK formulas

For formula-based links, use Find and Replace with the search scope and search setting checked before replacing. On Windows, choose Home > Find & Select > Replace, or press Ctrl+H. Expand Options if needed, set Within to Workbook or Sheet, and set Look in to Formulas. Search for a distinctive part of the old path, then inspect the matches before choosing Replace All.

For example, with the formula in A2 and the desired displayed label included as its second argument, this formula returns the clickable text Open report and points to the old web location: =HYPERLINK("https://old.example.com/docs/report.pdf","Open report"). In Find and Replace, searching for https://old.example.com/docs/ and replacing it with https://new.example.com/archive/ changes the path inside that formula. The displayed label remains Open report.

Use the narrowest search string that uniquely identifies the old location. Searching for a short word such as old could alter unrelated formulas, notes, or other URLs. If the path is assembled from cell references rather than written directly in the formula, replacing a text fragment in the formula will not change the referenced cell’s contents; update the source cell instead.

  1. Save a copy of the workbook before a workbook-wide replacement.
  2. Open Replace and expand Options. Set Look in to Formulas and choose the intended sheet or workbook scope.
  3. Use Find All first, where available, and review the listed cells to confirm they are the links you intend to change.
  4. Run Replace All, then click several changed links to check their destinations.

Edit an inserted hyperlink’s address

For a small number of regular hyperlinks, edit each destination directly. Select the cell, right-click it, and choose Edit Hyperlink. In the dialog, change the address or file path, leave the displayed text alone if it is already suitable, and confirm the edit. You can also select the cell and press Ctrl+K to open the link dialog in many desktop versions of Excel; if that opens an insert-link dialog rather than showing the existing address, use the right-click command.

This method is slower than Replace All, but it is clear and controlled. It also helps avoid changing a URL that happens to share a text fragment with the intended path. For a relative file link, verify the location from the computer or folder structure where the workbook will actually be used. A path that works on your computer may not exist for a colleague.

To check a link without opening its destination, right-click the cell and inspect Edit Hyperlink. For a web link, confirm the protocol and full address. For a local file, check the drive letter or network share as well as the folder and filename. Excel’s displayed label is not proof that the target is correct.

Bulk-change inserted hyperlinks with VBA

If many inserted hyperlinks share a known old path, VBA can loop through worksheet hyperlinks and replace that exact substring in each address. The example below scans every worksheet in the workbook that contains the macro. Edit both path strings before running it. The old path includes a trailing slash so that a folder named OldFolder does not unintentionally match a similarly named folder such as OldFolder2.

Save a separate copy before running any macro: VBA changes cannot be undone with Ctrl+Z. This code uses a case-sensitive comparison, which avoids changing differently capitalized URL paths that may be distinct on some servers. For Windows file paths, adjust the comparison only if you have considered the possibility of unintended matches.

Sub ReplaceHyperlinkPaths()
    Dim ws As Worksheet
    Dim hl As Hyperlink
    Dim oldPath As String
    Dim newPath As String
    Dim changedCount As Long

    ' Replace these examples with the exact old and new folder paths.
    oldPath = "C:\\Dept\\OldFolder\\"
    newPath = "D:\\Shared\\CurrentFolder\\"

    For Each ws In ThisWorkbook.Worksheets
        For Each hl In ws.Hyperlinks
            If Len(hl.Address) > 0 Then
                If InStr(1, hl.Address, oldPath, vbBinaryCompare) > 0 Then
                    hl.Address = Replace(hl.Address, oldPath, newPath, 1, -1, vbBinaryCompare)
                    changedCount = changedCount + 1
                End If
            End If
        Next hl
    Next ws

    MsgBox changedCount & " hyperlink address(es) updated."
End Sub

To run it in desktop Excel for Windows, press Alt+F11 to open the Visual Basic Editor, insert a standard module, paste the code, and replace the sample paths. Run the macro from the editor or Excel’s macro dialog. If the workbook is macro-enabled, save it as an .xlsm file. Review the workbook’s macro security settings and only run code you understand. The example updates addresses containing the old path; it does not intentionally rewrite subaddresses such as a worksheet name or cell reference.

Choose the right method and scope

The best method depends on how the links are stored and how many need changing. For one or two inserted links, Edit Hyperlink is usually the safest choice. For many formula links with a consistent literal path, Find and Replace is quick. For a large set of inserted links, VBA can save time, but only when the old path is specific and you can verify the results afterward.

Be precise about the scope. A replacement within the current sheet is less risky than one across the workbook. A workbook-wide search can find paths in formulas that are not hyperlinks, including formulas that build file names or text strings. Find All and review the references before using Replace All. If several worksheets use different old and new locations, handle each group separately rather than applying one broad replacement.

Also distinguish hyperlink destinations from external workbook references. A hyperlink that opens another workbook is not the same thing as a formula that links to cells in another workbook. Excel’s tools for managing workbook links do not automatically rewrite every hyperlink address, and changing a hyperlink does not repair broken formulas that refer to an external workbook.

Common problems and verification

If Replace All reports no matches, check Look in. Searching values will not find a path stored only inside a formula; searching formulas will not turn an inserted hyperlink’s hidden address into searchable cell text. Also check whether the old path is written with different slash characters, capitalization, URL encoding, or a slightly different folder name. A search for a complete path will not match a shorter or differently formatted version.

If the visible label changes but clicking still opens the old location, you changed the cell text, not the hyperlink address. Undo the text change if appropriate, then edit the hyperlink or use a suitable macro. If the destination changes but the link fails, verify that the replacement location exists and that you have permission to open it. Network shares and cloud-synced folders can be unavailable or mapped differently for other users.

After an update, verify more than one example: a link near the top and bottom of the affected range, links on different worksheets, and any links with unusual filenames. For a large change, use a copy of the workbook and test links before distributing it. If a cell contains a formula link, inspect the formula bar as well as clicking the link; if it is an inserted link, inspect Edit Hyperlink.

Windows, Mac, and Excel for the web

The instructions above use Excel for Microsoft 365 on Windows. On Mac, Find and Replace is available from Excel’s Edit menu, and the Replace dialog provides comparable search-scope options; keyboard shortcuts can differ by keyboard layout and macOS settings. The hyperlink-editing approach is similar: select or right-click a linked cell and open its link-editing command. If a Windows shortcut does not work on a Mac, use the menu rather than assuming the same keys.

Excel for the web supports editing workbook content and links, but it does not run VBA macros. Use the browser interface for individual link edits or formula replacements when available, and open the workbook in desktop Excel if a VBA bulk update is necessary. Because the web interface and desktop dialog options can vary, verify the resulting address rather than relying only on the number of replacements reported.

Frequently Asked Questions

Can Ctrl+H change the URL behind a hyperlink?

It can change a URL written in a cell value or formula, but it generally does not directly edit the hidden address of a regular inserted hyperlink. Use Edit Hyperlink for those links, or carefully use VBA for a large batch.

Why did Find and Replace change the link text but not its destination?

The displayed label is cell content, while a regular hyperlink’s target is stored separately. Replacing the label changes what appears in the cell; edit the hyperlink address to change where it opens.

Can I replace hyperlink paths throughout an entire workbook?

Yes, but the method depends on link type. Set Find and Replace to search formulas and choose Workbook scope for formula links. For inserted hyperlinks, edit them individually or use a reviewed VBA macro, then verify the changed links.

Does Excel for the web support the VBA method?

No. Excel for the web does not run VBA macros. Open the workbook in desktop Excel to run a macro, or update links individually in the browser.

Will changing a hyperlink fix a broken external workbook formula?

No. A hyperlink that opens a workbook and a formula that retrieves data from an external workbook are different things. Updating the link address does not automatically repair an external reference in a formula.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.