+ Reply to Thread
Results 1 to 7 of 7

macro for delete

  1. #1
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    macro for delete

    Hello to all,
    you can create a macro that does this?
    if I click DELETE in the range not yellow
    to appear a msgbox "You can not cancel this cell"
    I am attaching an example.
    max_max

    delete_canc.xls

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: macro for delete

    you can make every cell not yellow to locked and then add this code in worksheet change

    Please Login or Register  to view this content.
    however this method will not stop data being entered in locked cells
    dont know if this is exactly what you want
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro for delete

    Hello humdingaling,
    you do not see the message:
    MsgBox "You cannot cancel this cell"
    The yellow range B4: H5 is not locked the rest of the sheet.
    If you try to delete a different cell B4: H15 you do not see the message.
    but the message to excel, "" the cell or chart you are trying ........ "
    as the picture attached.
    max_max

    Appunti01.jpg

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: macro for delete

    did you lock the sheet?

    code just checks to see if cell is locked
    you need it unlocked in order to work
    Attached Files Attached Files

  5. #5
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro for delete

    Hello humdingaling,
    the your macro works only in unprotected workbook.
    This change to your macro editing cancels cells:

    Please Login or Register  to view this content.
    you can add more color changes as the cells, block the addition of columns or rows etc ...
    max_max

  6. #6
    Forum Contributor max_max's Avatar
    Join Date
    06-28-2013
    Location
    italy - venice
    MS-Off Ver
    Excel 2007
    Posts
    1,693

    Re: macro for delete

    Hello,
    I changed the macro, I have now entered:


    Please Login or Register  to view this content.


    because clicking CANC show the message to excel "The cell or chart you are editing...."?
    you can not see this message?
    max

  7. #7
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: macro for delete

    had a look around
    solution people just pointed to was to disable selection of protected cells
    http://www.mrexcel.com/forum/excel-q...on-prompt.html
    can that work for 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. Run Macro Automatically When delete row , changes cell,delete column
    By elevisse in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2012, 07:42 AM
  2. Macro to delete certain columns and delete rows based on time in another column
    By beepbeep27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2012, 11:47 AM
  3. How can I delete a macro when the Delete button is not active?
    By FCR in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-09-2006, 05:45 AM
  4. delete duplicates macro to color instead of delete
    By DKY in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2005, 01:50 PM
  5. Replies: 2
    Last Post: 09-13-2005, 12:05 AM
  6. [SOLVED] Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2005, 08:12 PM
  7. [SOLVED] Re: Macro to delete sheets and saves remaining file does not properly delete module
    By bhawane in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01:05 PM
  8. [SOLVED] Re: Macro to delete sheets and saves remaining file does not properly delete module
    By pherrero in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01:05 PM

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