Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Excel-VBA : Prevent Changing the WorkSheet Name

Many a times you need a scenario where you don’t want user to change the worksheet name in you Excel work book.

Its quite easy to do.


    • Go to VBA Editor
    • Expand your VBA Project
    • Select the any Sheet

Select WorkSheet

Select WorkSheet

  • Now select the “WorkSheet” from the first drop down on the right
Select WorkSheet from dropdown

Select WorkSheet from dropdown

  • Select the SelectionChange from the second drop down on the right
Select SelectionChange

Select SelectionChange

  • Now you will see the function Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  • Add the following code in the function.
If Sheet9.Name <> "FixedName" Then

   Sheet9.Name = "FixedName"

End If


And thats it you are done. Lets test our program.

Go to excel and try changing the worksheet name.

Prevent changing the sheet name

Prevent changing the sheet name


You may also like...

3 Responses

  1. Michael Akinya says:

    Hi, thanks for this code… seen it elsewhere as well. I’m trying to utilise it for a project, but the problem is that it doesn’t work. I found an article from cpearson that maybe explains why it isn’t working ( >> “When a user renames a worskheet no event procedure is triggered, so there is no event to trap the renaming, let alone cancelling the operation”

    Could you please shed more light to why it would not work as the code lines inside the procedure shell is simple enough… The procedure shell was auto generated, as I was in the relevant worksheet module.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: