7 Ways to Edit Links in Microsoft Excel

Do you need to change the destination URL, workbook reference, or the anchor text of a hyperlink in Excel? It would help if you learned how to edit Excel files or hyperlinks in Excel.

When your Excel workbook grows so much with datasets and needs external referencing, hyperlinking in Excel comes in handy. You can link one worksheet to another, one workbook to another, and even external websites or databases.

Excel also lets you update or edit those links to deal with broken links, update workbook references, or eliminate outdated website references. If you don’t know how to do all these, it’s completely cool! Just read this guide on Excel hyperlink editing to become a master of external reference management in Excel.

📒Read More: Check out this post on How to Remove Hyperlinks in Microsoft Excel!

Why Would You Want to Edit Links in Excel?

Find below why and when you might need to edit links in Excel:

  1. You often need to edit hyperlinks to correct errors in the destination address. For example, if a URL points to an outdated website, you can update it to the current portal.
  2. Customizing the display or anchor text is another major reason behind link editing in Excel. A hyperlink, like https://www.howtoexcel.org/clear-all-filters/ may not look well on grid-based cells of Excel. You can replace this with an anchor text Clear All Filters to make it more readable and logical.
  3. If the hyperlinks are as IP addresses and the DNS changed recently, you must edit and update it to quickly redirect the user to an external website and avoid DNS searching delays.
  4. Often you find that an employee or vendor changes the name of an Excel workbook to which another cell in another Excel file is dependent on fetching data for a formula. For example, the workbook reference Budget2022.xlsx was changed to Budget2023.xlsx. This creates a broken link issue. You must edit the reference link to fix it.
  5. External workbooks downloaded from third-party websites could contain malicious codes or links that you want to get rid of before using the Excel file. In this situation, you can manually edit those external reference links to make the Excel workbook safe.

Now, find below various methods and tricks to edit hyperlinks and workbook links in Excel:

Editing the Destination of Links in Excel

This is a major edit that you often need to make to keep external references always up to date. Find below two different ways to change the destination link in Excel:

Changing Hyperlinks on Excel Created Using Link To

If you added the hyperlinks in Excel cells by pressing Ctrl + K or right-click > Edit Hyperlink, follow these steps:

Edit link from Edit Hyperlink tool
Edit link from Edit Hyperlink tool
  1. Long-click the linked cell until the cursor changes to a cross from the hand-palm icon.
  2. Now, right-click or press Ctrl + K on the keyboard to get to the Edit Hyperlink dialog box.
  3. Delete the contents of the Address field in the dialog.
Copy paste new URL
Copy and paste the new URL
  1. Copy and paste the updated URL into the Address field.
  2. Click OK to save the changes made.

Modifying URLs in Excel Created Using the HYPERLINK Function

If you used the HYPERLINK formula to create linked cells or ranges in Excel, the previous method won’t work here. Here is what you need to do:

Select and delete URL or Link from Hyperlink
Select and delete the URL or Link from the Hyperlink function
  1. Long-click on the linked cell and let go when you see the cross icon.
  2. Now, click inside the Formula Bar.
  3. Select the linked URL as shown in the image.
  4. Press the Delete key to remove the old URL.
Updated a URL in Hyperlink formula
Updated a URL in the Hyperlink formula
  1. Now, copy the updated hyperlink from the source.
  2. Come back to Excel and press Ctrl + V to paste the link.
  3. Ensure the pasted URL is within double quotes.
  4. Hit Enter to save the changes you just made.

Editing the Anchor Text of Links in Excel

Another link customization you might need to do is to change the anchor or display the text of a link or hyperlink. Here are the two methods you need to know:

Altering Anchor Texts for Hyperlinks Created With Link To

Find text to display
Find text to display
  1. Open the Excel workbook in which you have hyperlinks that you want to edit.
  2. Click on the cell that contains the hyperlink you want to modify.
  3. Right-click on the hyperlinked cell.
  4. This action will open a context menu.
  5. In the context menu, select Edit Hyperlink. This option is usually near the bottom of the menu.
  6. Locate the Text to display field.
Editing anchor text in Edit Hyperlink
Editing anchor text in Edit Hyperlink
  1. Modify the content with an updated anchor text.
  2. Once you are satisfied with your changes, click the OK button in the Edit Hyperlink dialog box.

Changing Anchor Texts for URLs Created With the HYPERLINK Function

Editing the anchor text of a cell linked to a website, worksheet, or workbook is tricky if the hyperlinking was created with the HYPERLINK formula of Excel. Here’s how you can accomplish this feat:

Selecting refernced cell or anchor text in Hyperlink formula
Selecting the referenced cell or anchor text in the Hyperlink formula
  1. Long-click the cell containing a hyperlink that needs editing.
  2. When the icon changes to a cross from the hand palm, let go of the click.
  3. Now, click on the Formula Bar of the cell.
  4. You should then see the components of the hyperlinked cell.
  5. There are mostly two components as mentioned below:
    • A hyperlink to a website URL or Excel file on the PC within double quotes
    • A cell reference as a display text or a plain text as an anchor text within double quotes
  6. So, you need to select the referenced cell address or the plain text within double quotes.
How to edit link in Excel in Hyperlink formula
How to edit a link in Excel in the Hyperlink formula
  1. Replace the selected content with the new cell reference or plain text to use as an updated anchor text.
  2. Press Enter to save the changes.

📒Read More: Check out this post on How to Extract the URL from a Hyperlink in Microsoft Excel!

Editing the Graphics of a Linked URL in Excel

Suppose, you used Text Boxes or Shapes in place of anchor text or both to increase the visibility of your hyperlinks in Excel.

Now, you’ve decided to change the destination of the object or the object itself. Here’s how you can proceed:

Select and right click to edit link
Select and right-click to edit the link
  1. Right-click on the image or object or the text box linked to a URL or workbook.
  2. Click on the Edit Link option on the context menu that shows up.
Changing the destination address in an object hyperlink
Changing the destination address in an object hyperlink
  1. Go to the Address field of the Edit Hyperlink dialog.
  2. Change the hyperlink or workbook source mentioned in the Address field.
  3. Click OK to save the changes you just made.

Do you need to change the linked object or button but keep the destination? Unfortunately, there aren’t any shortcut to this like changing the object in its original cell.

You need to create a new Text Box or Shape, format it, and then add the hyperlink from the old object or button to the new one.

However, you can easily edit any text available in those buttons or objects. Here’s how:

Text editing option in a hyperlinked object
Text editing option in a hyperlinked object
  1. Right-click the object to activate it.
  2. Now, double-click on the text to select the whole text.
  3. As soon as you do this, the text formatting box will appear on the top.
  4. Now, you can change the typeface, font color, text size, font alignment, and so on.

Editing the Look of Hyperlinked Texts in Excel

You can also edit the links in Excel to make them more visible and beautiful especially when sending a report to a non-technical audience. Here are the methods you can follow:

Changing Appearance of the Cell and Text

Cell Styles for hyperlinked cells
Cell Styles for hyperlinked cells

The Cell Styles tool enables you to customize the view of the cell and text of a hyperlink. You can simply select one cell or a range of cells. Then, click the Cell Styles extension icon to find customization options as mentioned below:

  • Data and Model
  • Themed Cell Styles

You can go to New Cell Styles to create a unique cell and text formatting as well.

Editing the Text

Find below the quick steps to edit the appearance of the anchor or display text for a hyperlinked cell or cell range in Excel:

Format Cells in Excel
Format Cells in Excel
  1. Select one or many cells on your worksheet.
  2. Press Ctrl + 1 on your keyboard to bring up the Format Cells dialog.
  3. Go to the Font tab.
  4. Now, you can easily change the following properties of the anchor text:
    • Font
    • Font style
    • Size
    • Effects
    • Color
  5. Once you’re done with text formatting, click OK.

Editing Worksheet and Workbook Links in Excel

Like website URLs, you can also edit the hyperlinked addresses of worksheet and workbooks in Excel. In comparison to workbooks, editing worksheet reference is easier.

For workbooks, you need to carefully enter the complete location of the Excel file. Contrarily, you can change worksheet references visually using the Edit Hyperlink tool. Find below the steps you can try:

Updating a link to sheets of same workbook
Updating a link to sheets of same workbook
  1. Select the cell that contains a link referrencing to another worksheet in the same workbook.
  2. Press Ctrl + K to open the Edit Hyperlink dialog.
  3. There, you should see a tree of worksheets in the workbook.
  4. Select a different one from the tree to update the worksheet redirecting link.
  5. Click OK to update.

To edit a workbook refernece, you can do the following:

Updating workbook link in Excel
Updating workbook link in Excel
  1. Select the cell and bring up the Edit Hyperlink dialog by pressing Ctrl + K.
  2. Now, you can click the Look in drop-down and navigate to the folder where the target workbook is located.
  3. Click on the file and click OK to update the workbook hyperlink.
  4. Alternatively, you can enter a complete directory address of the workbook in the following format into the Address field:
c:/users/ctos/downloads/vgsales.csv

or

d:/excelworkbooks/vgsales.csv
  1. Again, click OK to save the changes made.

Edit Links Using Excel VBA

If you need to automate the link editing tasks in Excel, Excel VBA can help. You can write or use a few lines of codes to automate the whole thing and change the destination address or anchor text in a jiffy.

Find below a code to edit the destination and anchor text of a hyperlink by implementing minor code changes. Here are the steps:

A VBA script to edit destination and anchor text
A VBA script to edit destination and anchor text
  1. Open the Excel VBA Editor from Developer > Visual Basic.
  2. Now, click the the Insert button on the Excel VBA Editor toolbar.
  3. Choose Module and paste the following script into it:
Sub EditHyperlinkInCell()
    Dim ws As Worksheet
    Dim cell As Range
    Dim newURL As String
    Dim newText As String
    
    ' Set the target worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1")
    
    ' Set the target cell (A2)
    Set cell = ws.Range("A2")
    
    ' Define the new URL and anchor text
    newURL = "https://www.newurl.com" ' Replace with your desired URL
    newText = "Anchor Text"      ' Replace with your desired anchor text
    
    ' Check if the cell contains a hyperlink
    If cell.Hyperlinks.Count > 0 Then
        ' Edit the existing hyperlink in the cell
        cell.Hyperlinks(1).Address = newURL
        cell.Hyperlinks(1).TextToDisplay = newText
    Else
        ' If there is no existing hyperlink, create a new one
        cell.Hyperlinks.Add _
            Anchor:=cell, _
            Address:=newURL, _
            TextToDisplay:=newText
    End If
End Sub
  1. Click Save and close the Excel VBA Editor.
Macro dialog box

Now, press Alt + F8 keys to open the Macro dialog box. There, select the EditHyperlinkInCell macro and click Run to change the hyperlink URL, anchor text, or the both.

Here’s how you can modify the script:

  • Change "Sheet1" to actual worksheet name
  • Modify cell reference A2 in code element ws.Range("A2") to select the target cell
  • Enter the new hyperlink or workbook address in the newURL field within double quotes
  • Similarly, enter the new display text in the newText field within double quotes

The above VBA script will only work if you’ve inserted the hyperlink using the Link tool on the Insert tab.

If the target cell has a link created using the HYPERLINK function, use this script instead:

Sub EditHyperlinkInCellB2()
    Dim ws As Worksheet
    Dim cell As Range
    Dim formulaText As String
    Dim newURL As String
    Dim newText As String
    
    ' Set the target worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1")
    
    ' Set the target cell (C2)
    Set cell = ws.Range("C2")
    
    ' Define the new URL and anchor text
    newURL = "https://www.newurl.com" ' Replace with your desired URL
    newText = "Anchor Text"      ' Replace with your desired anchor text
    
    ' Check if the cell contains a HYPERLINK formula
    If InStr(1, cell.Formula, "=HYPERLINK(", vbTextCompare) > 0 Then
        ' Extract the formula text
        formulaText = cell.Formula
        
        ' Modify the URL and anchor text within the formula
        formulaText = Replace(formulaText, Chr(34) & "https://www.howtoexcel.org/change-table-style" & Chr(34), Chr(34) & newURL & Chr(34))
        formulaText = Replace(formulaText, Chr(34) & "Visit Now" & Chr(34), Chr(34) & newText & Chr(34))
        
        ' Set the modified formula in the cell
        cell.Formula = formulaText
    End If
End Sub

Edit Hyperlinks in Excel Using Office Scripts

Find below how can you automate the hyperlink editing in Excel for the web or Excel for Microsoft 365 desktop app using Office Scripts. This method works on links created using the Link tool.

Running Office Scripts in Excel
Running Office Scripts in Excel
  1. Go to the Automate tab and click the New Script command.
  2. Now, copy and paste the following Office Scripts code inside the Code Editor panel.
function main(workbook: ExcelScript.Workbook) {
	let selectedSheet = workbook.getActiveWorksheet();
	// Apply hyperlink to range A2 on selectedSheet}
	selectedSheet.getRange("A2").setHyperlink({textToDisplay: "Anchor", address: "https://www.newurl.com/updated1/"});
}
  1. Click the Save script button.
  2. Click Run to execute.

Here’s how to customize the script:

  • Change all the instances of A2 with the cell reference of the target cell for which you want to edit the anchor text and destination address.
  • Enter the new anchor text within double quotes into the textToDisplay field.
  • Similarly, enter the new link into the address field.

Find below another Office Scripts code that enables you to automate link editing for those cells that have the HYPERLINK function:

Office Scripts code to edit link in HYPERLINK function
Office Scripts code to edit link in HYPERLINK function
function main(workbook: ExcelScript.Workbook) {
	let selectedSheet = workbook.getActiveWorksheet();
	// Set range C2 on selectedSheet
	selectedSheet.getRange("C2").setFormulaLocal("=HYPERLINK(\"https://www.newurl.com/update1\",\"Anchor Text\")");
}

Note: Office Scripts-based automation is only available if you got Microosft 365 Businsess Standard or better subscription.

Conclusions

Mastering the art of editing links in Excel is a valuable skill that empowers you to take control of your data, streamline your work, and maintain the integrity of your spreadsheets.

Whether you’re fine-tuning hyperlinks to web resources, or optimizing links to external workbooks, understanding the ins and outs of link editing can save you time, prevent errors, and enhance your overall productivity.

The above methods are suited to different situations of link editing in Excel. Pick a method that suits your scenario. If you know any popular method that I missed or just want to give feedback, don’t forget to comment below.

About the Author

Bipasha Nath

Bipasha Nath

Bipasha is a technical content writer with 10+ years of experience in the technology industry. She previously worked in a SaaS software development company focused on SharePoint, OneDrive, Word, Excel, Word solutions.

Subscribe

Subscribe for awesome Microsoft Excel videos 😃

John MacDougall

I’m John, and my goal is to help you Excel!

You’ll find a ton of awesome tips, tricks, tutorials, and templates here to help you save time and effort in your work.

Related Posts

Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get the Latest Microsoft Excel Tips

Follow Us

Follow us to stay up to date with the latest in Microsoft Excel!

Subscribe for awesome Microsoft Excel videos 😃