How to Find and Replace Hyperlinks in Excel (3 Quick Methods)

Get FREE Advanced Excel Exercises with Solutions!

After setting hyperlinks in Excel you can easily edit them or find and replace them using some features of Excel. This article will provide you with 3 quick and useful methods to find and replace hyperlinks in Excel with sharp steps and clear illustrations.


How to Find and Replace Hyperlinks in Excel: 3 Ways

Let’s get introduced to our dataset first that represents some article’s IDs and corresponding websites.


1. Find and Replace All Hyperlinks in Excel

In our very first method, we’ll find all the hyperlinks in a sheet and then will replace them using the Find and Replace tool. From my dataset, I’ll replace the website address with the website name ‘ExcelDemy’.

Steps:

  • Press Ctrl + H to open the Find and Replace dialog box.
  • Then press Options.

Find And Replace All Hyperlinks in Excel

  • Next, click on the drop-down icon beside Format from the Find what.
  • Then from the list click Choose Format From Cell.

Soon after, you will see a plus icon with a dropper sign in your cursor.

Find And Replace All Hyperlinks in Excel

  • Click any cell that contains a hyperlink.

Find And Replace All Hyperlinks in Excel

  • Type the text by which you want to replace in Replace with box.
  • Finally, just press Replace All.

Now see that all the links are replaced.

Read More: How to Activate Multiple Hyperlinks in Excel


2. Find and Replace Specific Text from Hyperlinks

Here, we’ll find and replace a specific text from hyperlinks. For that, I have modified the dataset and inserted some article links. Now I’ll find the text ‘exdemy’ from the links and then will replace them with ‘exceldemy’.

Steps:

  • First, follow the first five steps to find the hyperlinks.
  • Then type exdemy in the Find what box and exceldemy in the Replace with box.
  • Finally, just press Replace All.

Find And Replace Specific Text from Hyperlinks

Then you will get that Excel has replaced the text from the hyperlinks.

Read More: How to Combine Text and Hyperlink in Excel Cell


3. Find and Replace Hyperlinks Using VBA in Excel

Here, I inserted some hyperlinks with the article IDs. And now we’ll apply VBA to find and replace specific text. See that there is a text ‘exdemy’ in the hyperlinks, we’ll replace it with ‘exceldemy’.

Steps:

  • Press Alt + F11 to open the VBA window.

Find And Replace Hyperlinks Using VBA in Excel

  • Then click as follows: Insert ➤ Module.

Find And Replace Hyperlinks Using VBA in Excel

  • Later, type the following codes in the module-
Sub Find_Replace_Hyperlinks()
Dim xWS As Worksheet
Dim xLink As Hyperlink
Dim OldLink As String, NewLink As String
Box_Title = "Find & Replace Hyperlinks"
Set xWS = Application.ActiveSheet
OldLink = Application.InputBox("Input Old Text:", Box_Title, "", Type:=2)
NewLink = Application.InputBox("Input New Text:", Box_Title, "", Type:=2)
Application.ScreenUpdating = False
For Each xLink In xWS.Hyperlinks
xLink.Address = Replace(xLink.Address, OldLink, NewLink)
Next
Application.ScreenUpdating = True
End Sub

Find And Replace Hyperlinks Using VBA in Excel

Code Breakdown

  • Here, I created a Sub procedure Find_Replace_Hyperlinks.
  • Then declared some variablesxWS As Worksheet, xLink As Hyperlink, OldLink As String, and NewLink As String.
  • Next, mentioned box title- “Find & Replace Hyperlinks“.
  • Then used ActiveSheet to select the activesheet.
  • After that, used InputBox(“Input Old Text:”, Box_Title, “”, Type:=2) to input the old text and used Application.InputBox(“Input New Text:”, Box_Title, “”, Type:=2) to input the new text.
  • Later, I used the For Loop to go through each Hyperlink to find the old text then used Replace to replace the old text with the new text.

  • Next, press the Run icon to run the codes.
  • At this moment, type the text that you want to replace and press OK.
  • Here, I typed exdemy.

Find And Replace Hyperlinks Using VBA in Excel

  • Then type the replacing text which is exceldemy.
  • Finally, just press OK.

Find And Replace Hyperlinks Using VBA in Excel

Now have a look, the text is replaced successfully.

Read More: How to Extract Hyperlink from URL in Excel


Practice Section

You will get a practice sheet in the Excel file given above to practice the explained ways.


Download Practice Workbook

You can download the free Excel template from here and practice on your own.


Conclusion

I hope the procedures described above will be good enough to find and replace hyperlinks in Excel. Feel free to ask any question in the comment section and please give me feedback.


Related Articles

<< Go Back To Hyperlink in Excel | Linking in Excel | Learn Excel

What is ExcelDemy?

ExcelDemy - Learn Excel & Get Excel Solutions Center provides online Excel training , Excel consultancy services , free Excel tutorials, free support , and free Excel Templates for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

2 Comments
  1. Hello, I used the VBA code and it works well. However, is it possible to create a code that loops through all of the worksheets in the workbook (there are hundreds) and replaces text without using the input box? So that I enter the text to find and the text to replace within the code, and it will run through each worksheet replacing all of the specified text in all of the hyperlinks throughout the entire workbook?

    • Hello Kellyn, thank you for reaching out. Here is a solution to your query. Use the code and replace the texts introduced by the OldLink and NewLink variables according to your preference.

      Sub Find_Replace_Hyperlinks_AllWorksheets()
      Dim xWS As Worksheet
      Dim xLink As Hyperlink
      Dim OldLink As String, NewLink As String
      OldLink = "exdemy"
      NewLink = "exceldemy"
      Application.ScreenUpdating = False
      ' Loop through all worksheets in the workbook
      For Each xWS In ThisWorkbook.Sheets
      ' Loop through all hyperlinks in the current worksheet
      For Each xLink In xWS.Hyperlinks
      xLink.Address = Replace(xLink.Address, OldLink, NewLink)
      Next xLink
      Next xWS
      Application.ScreenUpdating = True
      End Sub

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo