Donot allow user to change name of the worksheet

  • Thread starter Thread starter Pawan
  • Start date Start date
P

Pawan

Hi

I have a workbook with several sheets in it. However I donot want anyone to
change name of one worksheet named 'Data'. He can rename other sheets. Is it
possible to prevent user from changing name of one sheet?

(This is because my macro will delete all sheets except the one with name
'Data'. If user changes name of 'Data' sheet, tehn macro will delete it!)

Thank You
Pawan
 
Hi,

there's no sheetname_change event but there are several workarounds. One way
would be to look at your macro and use codename instead of name. While the
codename can be changed its fairly safe and of course you do have a backup
don't you. the example below assumes you sheet named "Data" has a codename of
sheet1

For Each Worksheet In Sheets
'If worksheet.Name <> "Data" Then
If Worksheet.CodeName <> "Sheet1" Then
Worksheet.Delete
End If
Next Worksheet


Mike
 
It worked...

Thanks Mike.. :)

Mike H said:
Hi,

there's no sheetname_change event but there are several workarounds. One way
would be to look at your macro and use codename instead of name. While the
codename can be changed its fairly safe and of course you do have a backup
don't you. the example below assumes you sheet named "Data" has a codename of
sheet1

For Each Worksheet In Sheets
'If worksheet.Name <> "Data" Then
If Worksheet.CodeName <> "Sheet1" Then
Worksheet.Delete
End If
Next Worksheet


Mike
 
Back
Top