+ Reply to Thread
Results 1 to 11 of 11

Disabling the DELETE key

  1. #1
    Registered User
    Join Date
    05-15-2013
    Location
    Corpus Christ, TX
    MS-Off Ver
    Excel 2010
    Posts
    23

    Disabling the DELETE key

    Team,

    I am creating a very large workbook within which I have created some validations and sheet / cell protection. I have some Yes / No drop downs that I want users to be able to change, so I cannot lock those cells. Validation provides protection only against changing, or removing information, but not the DELETE key.

    Is there a way to disable the DELETE key throughout the entire Workbook? I have attempted some VB scripting, but I am a complete novice at VB. I would appreciate some help with EXACTLY what I need to put, and where.

    I would want to disable the DELETE key for the entire workbook.

    Thank you all for your time.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Disabling the DELETE key

    Perhaps you don't actually need to disable the DELETE key...Try this example:


    With
    B3: (containing the Data Validation cell)

    • Set Cell B3 to UN-locked
    • Set Cell C3 to LOCKED
    • Select cells B3:C3
    • Home.Format.Format_Cells…Alignment_tab
    • Check: Merge cells
    Note: I generally avoid merged cells, but in this case they are helpful.

    Last….Protect the worksheet.

    The end result:
    Users will be able to select items from the dropdown list
    but will not be able to delete the contents or paste
    data into the cells.

    Note: There are ways around that meager security, but
    at least the users won't inadvertently ruin your sheet.
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    05-15-2013
    Location
    Corpus Christ, TX
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Disabling the DELETE key

    I appreciate the input, however that doesn't seem to solve the problem. All that seems to do is extend the drop-down cell. Even with protecting it, the DELETE key still removes all options. Shucks.

  4. #4
    Registered User
    Join Date
    08-29-2011
    Location
    Boise, ID
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Disabling the DELETE key

    This should do the trick.

    Please Login or Register  to view this content.
    Reference: http://support.microsoft.com/kb/101567

    RC

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Disabling the DELETE key

    have you tried
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Registered User
    Join Date
    05-15-2013
    Location
    Corpus Christ, TX
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Disabling the DELETE key

    I have tried various VB scripts but they don't seem to take effect. Where exactly should I be putting the scripts listed above?

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Disabling the DELETE key

    it depends when you want the key disabled. if it's for one sheet try the worksheet_Activate and worksheet_deactivate events in the worksheet code module to disable and enable it; if it's for the whole workbook use the workbook_open and workbook_beforeclose events in the thisworkbook module

  8. #8
    Registered User
    Join Date
    05-15-2013
    Location
    Corpus Christ, TX
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Disabling the DELETE key

    Forgive me for being a novice, but I am trying to accomplish this for the entire worksheet. The code I have entered in the "thisworkbook" module is:

    Private Sub Workbook_Open()
    Sub DisableKey()
    Application.OnKey "{DELETE}", ""
    End Sub

    I get errors every time I try to open the workbook. I'd appreciate some clarification as to what I'm doing wrong.

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Disabling the DELETE key

    remove the
    Please Login or Register  to view this content.
    line

  10. #10
    Registered User
    Join Date
    05-15-2013
    Location
    Corpus Christ, TX
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Disabling the DELETE key

    HOORAY! You fine folks have helped solve a problem in 20 minutes that I had been beating myself up over for the past two days. Thank you very much.

  11. #11
    Registered User
    Join Date
    08-29-2011
    Location
    Boise, ID
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Disabling the DELETE key

    Do not forget to reset the delete key. You will have unhappy users if you don't.

    Please Login or Register  to view this content.
    RC

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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