You can break all external links in an Excel workbook in one pass with a short VBA macro that loops through every link and calls BreakLink on it. The macro converts each linked formula into its last calculated value and removes the external reference, so the workbook stops asking you to update links. This is destructive: the live connection to the source file is gone, so save a copy of the workbook before you run it.
What You'll Need
- Excel for Windows or Mac with the workbook open. The
BreakLinkmethod is available in both, but the VBA editor is reached slightly differently (Alt+F11 on Windows; on Mac, use Tools > Macro > Visual Basic Editor). - The workbook saved at least once, because links to unsaved workbooks cannot be broken cleanly.
- Macro security set to allow macros. If macros are disabled, the code will not run; check File > Options > Trust Center > Trust Center Settings > Macro Settings on Windows, or Excel > Preferences > Security on Mac.
- Write access to the workbook. If it is shared or protected, unshare or unprotect it first.
Step-by-Step
- Make a backup copy. Use File > Save As and save a separate copy before you change anything. Breaking links cannot be undone with Ctrl+Z once the workbook is saved.
- Open the VBA editor. Press Alt+F11 on Windows. On Mac, go to Tools > Macro > Visual Basic Editor. The exact menu labels can differ slightly by version, device or region.
- Insert a module. In the editor, choose Insert > Module. A blank code window appears.
- Paste the macro. Use this code, which loops through the workbook's
LinkSourcesand breaks each one:
If your links point to non-Excel sources such as text files or databases, theSub BreakAllExternalLinks() Dim links As Variant Dim i As Long links = ActiveWorkbook.LinkSources(xlExcelLinks) If IsEmpty(links) Then MsgBox "No external links found." Exit Sub End If For i = LBound(links) To UBound(links) ActiveWorkbook.BreakLink Name:=links(i), Type:=xlLinkTypeExcelLinks Next i MsgBox "Done. " & UBound(links) - LBound(links) + 1 & " link(s) processed." End SubxlExcelLinksconstant will not catch them. In that case, replace it withxlLinkTypeExcelLinksfor Excel-to-Excel links and add a second loop usingxlLinkTypeOLELinksfor OLE links, or simply omit the type argument if you are unsure which type you have. - Run the macro. Press F5 while the cursor is inside the subroutine, or go back to Excel and use Developer > Macros, select
BreakAllExternalLinks, and click Run. If the Developer tab is hidden, right-click the ribbon and choose Customize the Ribbon to enable it. - Confirm the result. A message box reports how many links were processed. Check a few cells that previously contained formulas like
=[Budget.xlsx]Sheet1!A1; they should now show the last calculated value as a static number or text. - Save the workbook with File > Save. Reopen it to confirm the "This workbook contains links" prompt no longer appears. On Windows you can also check Data > Queries & Connections > Edit Links to confirm the list is empty; on Mac, use Edit > Links.
Common Mistakes
- Running the macro on the wrong workbook. The code uses
ActiveWorkbook, so the workbook you intend to clean must be the active window. If you have several open, click the correct one first or change the code toThisWorkbookand paste it into that workbook's own module. - Forgetting that values are frozen. Breaking a link keeps the last calculated value, not a live formula. If the source data changes later, the workbook will not update. Keep a copy with links intact if you may need to refresh.
- Assuming every link is an Excel link. Links to Access, SQL Server, text files or web queries are OLE or other link types and will be skipped by the sample above. Check Edit Links to see the actual types before running.
- Ignoring protected sheets. If sheets are protected,
BreakLinkcan fail silently or raise an error. Unprotect the workbook and sheets first, then reprotect afterward. - Not handling errors. A single broken or missing source file can stop the loop. Wrap the
BreakLinkcall inOn Error Resume NextandOn Error GoTo 0if you need the macro to continue past failures.
Tips
- Test the macro on a copy first, especially in workbooks with many formulas; breaking links can change calculated results if the source file was never opened and the cached value is stale.
- To find links before breaking them, run a quick loop over
LinkSourcesand write each name to a spare sheet or the Immediate window withDebug.Print. - If you only want to stop the update prompt without breaking links, use Edit Links and choose "Don't Update" or set the workbook to not ask; that keeps the links but leaves them pointing at the old source.
- For a one-off job, Edit Links > Break Link works without VBA, but it handles one link at a time. The macro is faster when a workbook has dozens of links.
- After breaking links, run a quick search for "[" in formulas (Ctrl+F, Look in: Formulas) to catch any external references the macro missed, such as links inside defined names or chart series.
Troubleshooting
- The macro says "No external links found" but Excel still prompts. The links may be in defined names, chart series, or data connections rather than cell formulas. Check Formulas > Name Manager and Data > Queries & Connections, and break those links through Edit Links or by editing the name or connection directly.
- "Method 'BreakLink' of object '_Workbook' failed." This usually means the workbook or a sheet is protected, the file is read-only, or the source file is unavailable. Unprotect, check file permissions, and retry.
- Values change after breaking links. The cached value was out of date. Restore your backup, open the workbook with links intact, allow Excel to update values, then run the macro again.
- The macro does not appear in the Macros list. The module may be in a different workbook, or macros are disabled. Confirm the code is in a standard module of the active workbook and that macro security allows it.
- Links reappear after saving. Something is recreating them, often a query refresh or an add-in. Check Data > Queries & Connections and disable automatic refresh before saving.
Frequently Asked Questions
Does breaking links delete the formulas?
It replaces each linked formula with its last calculated value, so the formula is gone but the result remains. Any other parts of the formula that did not depend on the link are also replaced by the final value.
Can I undo breaking links?
Not with Ctrl+Z after saving. Before saving, you may be able to undo, but the reliable approach is to keep a backup copy with links intact.
Will this work on Excel for Mac?
Yes, the BreakLink method and LinkSources are supported in Excel for Mac. The VBA editor is opened through Tools > Macro > Visual Basic Editor rather than Alt+F11.
Why does Excel still ask to update links after I run the macro?
Some links live outside cell formulas, such as in defined names, chart series, or data connections. Break those through Edit Links, Name Manager, or the connection properties, then save again.
Can I break links without VBA?
Yes. Use Data > Edit Links (Windows) or Edit > Links (Mac), select each source, and click Break Link. VBA is simply faster when there are many links.
Does breaking links affect other workbooks?
No. The macro only changes the active workbook. The source files are untouched, so other workbooks that link to them continue to work normally.