linked cells - source sheetname changes

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
1,808
I need to make changes to 140 odd sheet names in my master file. each of these sheets is linked to a range of cells in a WIP report. How can I make my name changes and not lose the links to the other workbook? can you create a link to a sheets index rather than name??
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

dafan

Well-known Member
Joined
May 6, 2008
Messages
692
If you change your sheet name in your master file any references in any subfile will change too.

For example
Code:
'[Filename]Sheet1'!A1
will change to
Code:
'[Filename]Sheet1-1'!A1
if you change Sheet1 to Sheet1-1 in Filename.
 
Last edited:

ajm

Well-known Member
Joined
Feb 5, 2003
Messages
1,808
thanks dafan. perhaps you can help further. I have a list of the existing sheet names next to the new sheet names. i need to loop through each sheet, find the existing sheet name in my list, and then change it to the new name. any ideas?
 

dafan

Well-known Member
Joined
May 6, 2008
Messages
692
This code is not complete as I'm not sure how to refer to sheetnames dynamically:
Not tested.


Say A1 houses your current sheetname, B1 is new sheetname. You have 4 sheets
Code:
For i = 1 to 4

 Cursheet = Range("A" & 1).Text
 Newsheet = Range("B" & 1).Text
 Sheets(Cursheet).Name = Newsheet
Next i

Good luck. HTH.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,048
Messages
5,639,769
Members
417,111
Latest member
buyukbang

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
Top