+ Reply to Thread
Results 1 to 5 of 5

Macro for disabiling del and backspace keys in a cell

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Macro for disabiling del and backspace keys in a cell

    Hello,

    Can anyone please suggest me VBA code for disabiling Back Space key and Del key in Sheet1, Cell B5 alone please?

    My sincere thanks for all helps.

    Thanks and regard,
    gm2612

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Macro for disabiling del and backspace keys in a cell

    Do you only wish to prevent the cell being changed, or may other values be entered into the cell?
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Smile Re: Macro for disabiling del and backspace keys in a cell

    Hello Izandol,

    I have the cell B5 in "sheet1", which is key for an event macro. When a name of the customer is entered, if the entered name is not in the master list, the macro will create a new sheet in the name of new customer and copy paste the table from the sheet "Template". By any chance, if I press Del or use back space key to clear the cell, then the "Sheet1" itself getting changed. In order to prevent such mishaps, I would like to disable use of back space key up to the beginning of cell as well DEL key in the cell B5 only..

    I have attached the xl spreadsheet for your reference. Can you please suggest any methods please?

    Thanks and regards,
    gm2612

    to disable del and backspace key.xls

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Macro for disabiling del and backspace keys in a cell

    I do not have Excel available now but with Change event you may test length of B5 and undo if it is 0
    [Code]if Len(range("b5").value) = 0 then
    Application.undo
    Else
    '// code for creating sheets
    End if[code]

  5. #5
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2002
    Posts
    53

    Re: Macro for disabiling del and backspace keys in a cell

    Thank you Izandol. It is perfect now. Thanks a lot for your support.

    Regards,
    gm2612

+ 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. Enable backspace key in combobox on Userform
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2011, 05:35 PM
  2. Assigning backspace and delete to form buttons
    By solnajeff in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2010, 09:32 AM
  3. Disabiling Combobox
    By ramchalla in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-19-2009, 06:33 AM
  4. How to use Alt keys + symbol keys to invoke a macro?
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2005, 05:00 PM
  5. [SOLVED] Backspace and percentage, please help
    By broogle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-06-2005, 06:06 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