VBA to Prevent From Changing Worksheet Name in Microsoft Excel

If you want to learn a way to fix the name of the sheet using VBA then this article is for you.


In this article we will learn how to use VBA code in order to keep the same name for a worksheet i.e. if anyone wants to change the name then they are not allowed to do so.


Following is the snapshot of the worksheet contains two sheets; Permanent & Temporary


image 1


We need follow the below steps to fix the name of the Permanent sheet to “Permanent” itself.

  • Click on Developer tab
  • From Code group, select Visual Basic

image 2


  • Enter the following code in the current worksheet module

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Sheet1.Name <> “Permanent” Then

    Sheet1.Name = “Permanent”

End If

End Sub


image 3


  • After copying the code; if we try to change the name of the “Permanent” sheet then excel will not allow us.

In this way we can ensure the same name of the worksheet as before.


Excel  Download-Sample File

Users are saying about us...

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Youtube