0:00
If you want to limit the number of worksheets in a workbook, follow these instructions
0:05
Press Alt-F11 to open the VBA Editor. In the Project Explorer, double-click the This Workbook object to open its code editor
0:13
Make sure you are using the This Workbook code editor. Insert the workbook's new sheet Event Procedure
0:18
This procedure executes every time a new worksheet is inserted in the workbook
0:23
Insert the code into the code editor as shown on the screen. This code sets a maximum limit of three worksheets, but you can change this number as needed
0:31
Close the VBA Editor and try adding new sheets to see if the code correctly prevents adding more than the specified number of sheets
0:37
You can see the code is working. It does not allow users to add more than three worksheets
0:42
This solution prevents adding new sheets beyond the limit but does not restrict other actions, such as deleting existing sheets
0:49
Thanks for watching. Please like, share, and subscribe for more Excel tips and VBA code snippets
0:56
For more help, visit http://excel.org