Removing links to other documents on a specific sheet in workbook

mcomp72

Active Member
Joined
Aug 14, 2016
Messages
275
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2011
Platform
  1. Windows
  2. MacOS
I have created a workbook that is sometimes used by multiple people for the same project. Thus, I have built in a way for the user to import data from one workbook to another, as they may be using different files between them, and ultimately someone will need to "marry" the data together into one file.

On one particular sheet in the workbook, sometimes a user might have formulas that links to another workbook. I don't want these links to be imported, so I need code to delete them, BUT I don't want to delete the rest of the formula.

For instance, if the link in the formula is:

='C:\Users\matt\Desktop\[Test Workbook.xlsx]My Sheet'!$B$2

Then I want to change the formula to:

='My Sheet'!$B$2

I thought about using ".BreakLink", but I believe this will break links across the entire workbook, and I don't want to do that. I only want to do it on one specific sheet.

Oh, and this would need to work on both Windows & Mac. But if you have thoughts for how to make it work on Windows, I may be able to modify the code, if necessary, to make it work on Mac.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
it is possible to search and replace within formulas.
so in that sheet do replace
find: 'C:\Users\matt\Desktop\[Test Workbook.xlsx]My Sheet'!
replace with 'My Sheet'!
click on options and set "Look In:" to formulas
then do replace all.
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,183
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top