Be the first user to complete this post
|Add to List|
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
- Now select the "WorkSheet" from the first drop down on the right
- Select the SelectionChange from the second drop down on the right
- 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.
- VBA-Excel: Modified Consolidator – Merge or Combine Multiple Excel Files Into One Where Columns Are Not In Order
- VBA-Excel: Create worksheets with Names in Specific Format/Pattern.
- Excel-VBA : Open a Excel File using Another Excel File using Browse Option.
- Send Mail With Link to a Workbook, From MS Outlook using Excel.
- VBA-Excel: Perform Google Search on Internet Explorer using Microsoft Excel
- VBA-Excel: Clear data from Excel Sheet(WorkSheet)
- VBA-Excel: Copy/Paste data - Copy the Entire row data and paste it to another row
- VBA-Excel: Fill Excel Range Values in a 2D Array