+ Reply to Thread
Results 1 to 9 of 9

Not allow new worksheets to be added

  1. #1
    Registered User
    Join Date
    07-21-2014
    Location
    Toronto, ON
    MS-Off Ver
    MS Office 2010
    Posts
    55

    Not allow new worksheets to be added

    Hi:

    I have a shared worksheet that sits on a network. It is entirely password protected so users can open it to review/ print data but not edit. I want to assure that new worksheets can NOT be added to the file so I added the code below to the Workbook_New Sheet module. It produces the message but allows the new worksheets to be added. If the file is closed, those sheets are not saved. However, if the user types something on one of the new sheets, it IS saved. Does anyone know how to prevent the worksheet from even being created? I have used this code before and it worked so not sure where I am going wrong.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Not allow new worksheets to be added

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-21-2014
    Location
    Toronto, ON
    MS-Off Ver
    MS Office 2010
    Posts
    55

    Re: Not allow new worksheets to be added

    Thank you but I was able to add the new worksheets and save them

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Not allow new worksheets to be added

    His code works just fine for me. Are you sure you enabled Macros/put it in the correct spot?
    If you are happy with my response please click the * in the lower left of my post.

  5. #5
    Registered User
    Join Date
    07-21-2014
    Location
    Toronto, ON
    MS-Off Ver
    MS Office 2010
    Posts
    55

    Re: Not allow new worksheets to be added

    Yes - It is placed in the "This Workbook" module of the file and the entire file has macros so it is a macro enabled file. It did not work for me with Excel 2010

  6. #6
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Not allow new worksheets to be added

    And have you made sure that EnableEvents is turned on?

    in the Immediate window (Ctrl+G) type and enter:

    Please Login or Register  to view this content.

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,177

    Re: Not allow new worksheets to be added

    See the attached example. Enable macros and see if you can add a sheet. You should see a flicker as it creates and then immediately deletes it. See the Immediate Window to prove the point.

  8. #8
    Registered User
    Join Date
    07-21-2014
    Location
    Toronto, ON
    MS-Off Ver
    MS Office 2010
    Posts
    55

    Re: Not allow new worksheets to be added

    No. It still didn't work even in this file. I added and saved 2 sheets. I am trying to upload the file to show you that I didn't make any adjustments but it is taking too long for it to upload

  9. #9
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Not allow new worksheets to be added

    You might want to look through your Trust Center Settings to make sure macros are enabled and there are no other conflicts. If everything is good on that end I wonder if there is something wrong with your copy of excel (seeing as how no one else is experiencing the same issue as you)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Autofill Summary macro as new worksheets are added
    By rsmiley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-12-2014, 04:18 AM
  2. Fix macro to work when worksheets are added
    By messermc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2013, 11:17 AM
  3. Dynamic array in VBA of newly added worksheets
    By greglittle in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-22-2012, 06:00 PM
  4. Summary of a workbook that new worksheets will be continually added.
    By OREGFARR in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2012, 05:27 AM
  5. Data that has been added/changed/deleted between two worksheets
    By frank_france in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-09-2012, 05:55 PM
  6. Calculating totals from user added worksheets
    By drgogo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-12-2010, 07:50 AM
  7. Worksheets not being added
    By msleger in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-02-2007, 11:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1