Protected Workbook - allow users to change tab name

WisdomandLaughter

New Member
Joined
May 28, 2008
Messages
35
Good day,
I am using the following code to allow users to unhide sheets in a protected workbook without compromising the structure of the workbook
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p><o:p></o:p>
Sub Protect()<o:p></o:p>
<o:p></o:p>
ActiveWorkbook.Unprotect<o:p></o:p>
Application.Run "Update.xls!GotoNextHiddenWS"<o:p></o:p>
ActiveWorkbook.Protect Structure:=True, Windows:=False<o:p></o:p>
<o:p></o:p>
End Sub
<o:p></o:p>
Is there a way to also allow users to change the tab names without compromising the structure of the workbook?

Thank you!
Judy
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
If I understand what you are doing correctly.

You could create a Macro activated by a Key combination, which then opens an Input Box in which the Users can type the new name. The Macro could then unprotect, change the name then protect again.

ColinKJ
 
Upvote 0
Colin,

Thank you for the direction. That is exactly what I would like to do. If you have a moment and wouldn't mind, would you be able to provide a sample code along those lines?

Judy
 
Upvote 0
Colin,

I had another thought that might be less complicated. The name of the sheet would be the same as cell c1. Is it possible to base the worksheet name (on the tab) on whatever value is entered in c1?

Thanks,
Judy
 
Upvote 0
Hi Judy,

The first option, an input box activated with Ctrl+q, you need to set which key.

Code:

Sub RenameTab()
'
'
' Macro recorded 10/03/2009 by Colin
'
' Keyboard Shortcut: Ctrl+q
'
x = ActiveSheet.Name
a = InputBox("Enter New Tab Name", "Change Tab Name", x)
If a = "" Then GoTo endd
ActiveWorkbook.Unprotect
On Error Resume Next
ActiveSheet.Name = a
On Error GoTo 0
ActiveWorkbook.Protect Structure:=True, Windows:=False

endd:
End Sub

Code:

Second option:

The Tab name is changed to whatever is entered into C1

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 3 Then
If Cells(1, 3) = "" Then GoTo endd
ActiveWorkbook.Unprotect
On Error Resume Next
ActiveSheet.Name = Cells(1, 3).Text
On Error GoTo 0
ActiveWorkbook.Protect Structure:=True, Windows:=False
End If
endd:
End Sub

Code:

This code needs to be entered on each Sheet.

Regards

ColinKJ
 
Upvote 0

Forum statistics

Threads
1,203,071
Messages
6,053,369
Members
444,658
Latest member
lhollingsworth

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