ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sheet name change (https://www.excelbanter.com/excel-programming/351375-sheet-name-change.html)

spacecityguy[_10_]

Sheet name change
 

Is there a way to detect sheet name changes or prevent user from
changing the name of a sheet? Thanks.


--
spacecityguy
------------------------------------------------------------------------
spacecityguy's Profile: http://www.excelforum.com/member.php...o&userid=11060
View this thread: http://www.excelforum.com/showthread...hreadid=504683


Tim Williams

Sheet name change
 
You could protect the workbook.
Alternatively, if the problem with the changing sheet names is related to
referencing the sheets in VBA, use the sheet codename instead.

Eg:

Sheet1.Range("A1")
instead of
ThisWorkbook.Sheets("Sheet1").Range("A1")

Tim.

--
Tim Williams
Palo Alto, CA


"spacecityguy"
wrote in message
news:spacecityguy.225uon_1138142404.8435@excelforu m-nospam.com...

Is there a way to detect sheet name changes or prevent user from
changing the name of a sheet? Thanks.


--
spacecityguy
------------------------------------------------------------------------
spacecityguy's Profile:

http://www.excelforum.com/member.php...o&userid=11060
View this thread: http://www.excelforum.com/showthread...hreadid=504683




spacecityguy[_12_]

Sheet name change
 

I can't protect the workbook becuase I've to allow the user to input
into my file. I do use the sheet's codename in my code, and the problem
I have is with something that Excel may not expect me to do. I tried to
write a "patch" utility in VBA that will replace a sheet in a file
(template file) that has VBA code. Since I can't change the sheet's
codename, my code in the template file must refer to the sheet by its
"given" name (otherwise my code in the template file will break after
my patch deletes the sheet). But when I use the "given" name, I've to
worry about the user changing it. Thanks again.


--
spacecityguy
------------------------------------------------------------------------
spacecityguy's Profile: http://www.excelforum.com/member.php...o&userid=11060
View this thread: http://www.excelforum.com/showthread...hreadid=504683


Tim Williams

Sheet name change
 
I *think* you can change the sheet's codename using VBA.

If not, you might consider adding a hidden name to the inserted sheet and
then identify it by checking each sheet for the name.


Tim

--
Tim Williams
Palo Alto, CA


"spacecityguy"
wrote in message
news:spacecityguy.22baqz_1138396502.8767@excelforu m-nospam.com...

I can't protect the workbook becuase I've to allow the user to input
into my file. I do use the sheet's codename in my code, and the problem
I have is with something that Excel may not expect me to do. I tried to
write a "patch" utility in VBA that will replace a sheet in a file
(template file) that has VBA code. Since I can't change the sheet's
codename, my code in the template file must refer to the sheet by its
"given" name (otherwise my code in the template file will break after
my patch deletes the sheet). But when I use the "given" name, I've to
worry about the user changing it. Thanks again.


--
spacecityguy
------------------------------------------------------------------------
spacecityguy's Profile:

http://www.excelforum.com/member.php...o&userid=11060
View this thread: http://www.excelforum.com/showthread...hreadid=504683





All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com