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:
- 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.
- Click any cell that contains a hyperlink.
- 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.
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.
- Then click as follows: Insert ➤ Module.
- 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
Code Breakdown
- Here, I created a Sub procedure Find_Replace_Hyperlinks.
- Then declared some variables– xWS 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.
- Then type the replacing text which is exceldemy.
- Finally, just press OK.
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
- [Fix:] Hyperlink to Website Not Working in Excel
- Hyperlink in Excel Not Working
- How to Solve ‘Cannot Open the Specified File’ Error in Excel Hyperlink
- [Fixed!] Hyperlinks in Excel Not Working After Saving
- [Fixed!] Excel Hyperlink Keeps Coming Back
- [Fixed!] Excel Hyperlink Formula Not Working
- [Fixed!] Excel Hyperlink Is Not Redirecting Properly
<< Go Back To Hyperlink in Excel | Linking in Excel | Learn Excel
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.