+ Reply to Thread
Results 1 to 3 of 3

VBA, Disable/Prevent Delete Sheet in Excel 2013/2016 without protecting workbook, Help!

  1. #1
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    VBA, Disable/Prevent Delete Sheet in Excel 2013/2016 without protecting workbook, Help!

    Hi All,

    linkback http://www.mrexcel.com/forum/excel-q...book-help.html

    I want to disable/prevent user to delete sheet (both through Home > Cells > Delete Sheet, or Right click on sheet > Delete), but I can't use protect workbook for this one. so VBA code is the only way, I've search anywhere but it fails because the code for excel 2007.

    block this menu
    FORUM.JPG

    block this right click menu too
    Capture2.JPG

    Please help,
    thanks a lot
    warm regards

    Adrian

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA, Disable/Prevent Delete Sheet in Excel 2013/2016 without protecting workbook, Help

    There is no really elegant way to do this. There is one suggestion (which I have not confirmed) on this page. This implements workbook-level protection but only temporarily, long enough to prevent the sheet from being deleted:

    You can prevent a sheet from being deleted via the Worksheet_BeforeDelete Event as follows:
    Please Login or Register  to view this content.
    This will protect all sheets from being deleted. However, if you add some event code like the following on the ThisWorkbook module:
    Please Login or Register  to view this content.
    The user will then be able to delete any other sheet as soon as they select it.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-12-2015
    Location
    Surabaya, Indonesia
    MS-Off Ver
    MS 365 (Windows 11 64-bit)
    Posts
    84

    Re: VBA, Disable/Prevent Delete Sheet in Excel 2013/2016 without protecting workbook, Help

    Hi StringJazzer,

    thanks for the reply, but, well, seems there's no better option out there... will postpone this idea.

    cheers

    Adrian

+ 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. Prevent online help in excel 2016
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-19-2016, 04:18 AM
  2. Macro From Excel 2013 Not Working in 2016
    By tm1238 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-08-2016, 04:39 PM
  3. [SOLVED] disable right click on sheet delete/insert sheet in excel
    By rana19 in forum Excel General
    Replies: 7
    Last Post: 10-08-2015, 05:16 AM
  4. Disable delete sheet in Excel 2010
    By SteveRMS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2015, 12:10 PM
  5. Excel 2010 Prevent Delete Sheet
    By nick.lamps in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2014, 10:03 PM
  6. [SOLVED] Disable Insert Column without protecting sheet.
    By Steven in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2006, 01:35 PM
  7. Protecting Sheet to Prevent Viewing At All
    By Michael Link in forum Excel General
    Replies: 9
    Last Post: 09-25-2005, 04:05 AM

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