KutoolsforOffice — One Suite. Five Tools. Get More Done.

How to change multiple hyperlink paths at once in Excel?

AuthorXiaoyangLast modified

If you need to update the same file path or web address in multiple hyperlinks, you do not have to edit each link individually. You can replace the shared part of all the hyperlink addresses at once. This tutorial covers two ways to do it: using VBA or Kutools for Excel.

Change multiple hyperlink paths in the active worksheet with VBA

Change hyperlink paths in a selection, worksheets, or workbooks with Kutools for Excel

Frequently Asked Questions


Compare the methods for changing multiple hyperlink paths

MethodBest forKey difference
VBA codeReplacing part of the hyperlink addresses on the active worksheetUses Excel's built-in VBA environment, but requires running a macro and is limited to the active sheet.
Kutools for ExcelChanging hyperlink paths in a selection, the active sheet, selected sheets, the active workbook, specific open workbooks or worksheets, or all open workbooksRequires no code and lists the matching cells in the Navigation pane before you replace the paths.

Change multiple hyperlink paths in the active worksheet with VBA

If the hyperlinks you want to update are all on the active worksheet, the following VBA code can replace the shared part of their file paths or addresses at once.

Worksheet containing multiple hyperlinks with the same path

  1. Press Alt + F11 to open the Microsoft Visual Basic for Applications window.
  2. Click Insert > Module, and paste the following macro into the Module window.

    VBA code: Change multiple hyperlink paths at once

    Sub ReplaceHyperlinks()
        'Updated by Extendoffice
        Dim Ws As Worksheet
        Dim xHyperlink As Hyperlink
        Dim xOld As String, xNew As String
        Dim xTitleId As String
    
        xTitleId = "KutoolsforExcel"
        Set Ws = Application.ActiveSheet
        xOld = Application.InputBox("Old text:", xTitleId, "", Type:=2)
        xNew = Application.InputBox("New text:", xTitleId, "", Type:=2)
        Application.ScreenUpdating = False
        For Each xHyperlink In Ws.Hyperlinks
            xHyperlink.Address = Replace(xHyperlink.Address, xOld, xNew)
        Next
        Application.ScreenUpdating = True
    End Sub
    
  3. Press F5 to run the code. In the first prompt box, enter the existing text in the hyperlink path, and then click OK.
    Entering the existing hyperlink path in the VBA prompt
  4. In the second prompt box, enter the new text you want to use in the hyperlink path.
    Entering the new hyperlink path in the VBA prompt
  5. Click OK. The matching text in all hyperlink addresses on the active worksheet is replaced, as shown below.
    Original hyperlink pathsArrow pointing to the updated resultsHyperlink paths after replacement

Change hyperlink paths in a selection, worksheets, or workbooks with Kutools for Excel

For more control over where the hyperlinks are updated, use the Find and Replace feature in Kutools for Excel. It can search a selection, the active sheet, selected sheets, the active workbook, specific open workbooks or worksheets, or all open workbooks.

Kutools for Excel offers over 300 advanced features to streamline complex tasks, boosting creativity and efficiency. Integrated with AI capabilities, Kutools automates tasks with precision, making data management effortless. Detailed information of Kutools for Excel...         Free trial...

📝 Note:

To use this method, first download and install Kutools for Excel.

  1. Click Kutools > Navigation.
    Opening the Navigation pane from the Kutools tab
  2. In the Navigation pane, open the Find and Replace section, select the Replace tab, and then configure the following options:
    • Enter the existing hyperlink text in the Find what box, and enter the new text in the Replace with box.
    • Choose the area you want to search from the Within drop-down list.
    • Select Hyperlinks from the Look in drop-down list.
    • Click Find All. The cells containing matching hyperlink addresses are listed at the bottom of the pane.
    Setting the hyperlink search scope and replacement text in the Navigation pane
  3. Click Replace All. The matching text in the hyperlink paths is replaced with the new text.
    Hyperlink paths after the old text has been replaced

Click to Download Kutools for Excel for Free Trial!


Frequently Asked Questions

Will these methods change the text displayed in the cell?

No. The methods described above replace matching text in the hyperlink address. The cell's displayed text remains unchanged unless it is edited separately.

Can I change hyperlink paths in several workbooks at the same time?

The VBA code in this article works only on the active worksheet. Kutools can search specific open workbooks or all currently open workbooks in one operation.

Should I make a backup before replacing hyperlink paths?

Yes. A bulk replacement can affect many links at once, and changes made by a macro cannot be undone with Ctrl + Z. Save a backup copy first, especially when working with multiple sheets or workbooks.


Related articles:

  • Extract Actual Addresses From Hyperlinks
  • Supposing you have a range of cells which contain hyperlinks, and now you need to see the real destination of the hyperlinks and extract them from the hyperlinks as following screenshot shown. Are there any easy ways to solve this problem quickly?
  • Convert Image URLs To Actual Images In Excel
  • If you have a list of image URL addresses in column A, and now, you want to download the corresponding pictures from the URLs and display them into the adjacent column B as left screenshot shown. In Excel, how could you extract the actual pictures from the image URLs quickly and easily?
  • Convert Url Text To Clickable Hyperlink In Excel
  • Supposing you have multiple urls in your worksheet, but they are not linked, and now you need to convert all the unlinked urls to clickable hyperlinks, as following screenshots shown. Of course, you can double click them one by one to make them clickable, but this will be time consuming if there are lots of urls. How could you convert multiple unlinked urls to clickable hyperlinks automatically in Excel?
  • Open A Specific Page Of PDF Document From Excel Hyperlink
  • When you link a cell to a PDF file, normally, you will go to the first page of the PDF file when you click to open the hyperlink. If you need to directly jump to a specific page of the PDF file by clicking the hyperlink, this article may do you a favor.

Best Office Productivity Tools

🤖Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |  Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |  Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more
Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

All Kutools add-ins. One installer

Kutools for Office suite bundles add-ins for Excel, Word, Outlook & PowerPoint plus Office Tab Pro, which is ideal for teams working across Office apps.

ExcelWordOutlookTabsPowerPoint
  • All-in-one suite — Excel, Word, Outlook & PowerPoint add-ins + Office Tab Pro
  • One installer, one license — set up in minutes (MSI-ready)
  • Works better together — streamlined productivity across Office apps
  • 30-day full-featured trial — no registration, no credit card
  • Best value — save vs buying individual add-in