Protect the name of a tab

Roccofan

Board Regular
Joined
Apr 18, 2002
Messages
61
How can I prevent users from changing the names of tabs in my workbook?

RF
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Hero-0952

Wizard Deluxe
Joined
Jun 11, 2002
Messages
348
Hello Roccofan.
The quick way to do this is to go to Tools / Protection / Workbook. You may use a password or just click OK without using a password. This will take away the right-click option and the Format / Rename options to rename the worksheet tab.

Regards,

ViperGTS
 
Upvote 0

stevebausch

Well-known Member
Joined
May 11, 2002
Messages
810
Investigate the Tools-Protection options.

I can't recall if protecting the worksheet will protect the sheet tab names, or if protecting the workbook will protect the sheet tab names.
 
Upvote 0

GeorgeB

Board Regular
Joined
Feb 16, 2002
Messages
239
Write some code in the Workbook before close event that will cycle through the sheets. Then in the sheet activate events check the sheet name and change it back if it has been changed.
 
Upvote 0

Roccofan

Board Regular
Joined
Apr 18, 2002
Messages
61
Thanks guys, but I only want to protech the name of the sheet not the cells in the sheet.

George B: If you could provide some sample code, I could take it from there.

Thanks.

RF
 
Upvote 0

stevebausch

Well-known Member
Joined
May 11, 2002
Messages
810
You just need to select the whole sheet, FormatCells-Protection, and uncheck the Locked checkbox.

Then you can have the sheet protected, the sheet tab names locked, but the cells are wide-open for editing.
 
Upvote 0

GeorgeB

Board Regular
Joined
Feb 16, 2002
Messages
239
Put this in the workbook before close event

Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each sht In Worksheets
sht.Activate
Next
'//Cycle thrugh twice to get al sheets
For Each sht In Worksheets
sht.Activate
Next
End Sub

This in each sheet you want to protect
Just change TEST to the name of the sheet

Private Sub Worksheet_Activate()
If ActiveSheet.Name <> "TEST" Then
MsgBox prompt:="This sheet must be named TEST", _
Title:="NOTICE"
ActiveSheet.Name = "TEST"
End If

End Sub
 
Upvote 0

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
On 2002-08-28 11:21, Roccofan wrote:
Thanks guys, but I only want to protech the name of the sheet not the cells in the sheet.

George B: If you could provide some sample code, I could take it from there.

Thanks.

RF

As Viper and Steve have said, just protecting the workbook will protect the sheet name, you don't really need code for this as all sheet names will be protected anyway. You can also protect the workbook without protecting individual worksheets if you wish.
This message was edited by Mudface on 2002-08-28 11:56
 
Upvote 0

Forum statistics

Threads
1,191,707
Messages
5,988,230
Members
440,139
Latest member
ngaicuong2017

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