+ Reply to Thread
Results 1 to 6 of 6

Alert before deleting contents of a cell

  1. #1
    Registered User
    Join Date
    02-26-2016
    Location
    Sturminster Newton
    MS-Off Ver
    2013
    Posts
    1

    Alert before deleting contents of a cell

    Hi, I would like to add an alert to an Excel 2013 spreadsheet that is used by a number of members staff. The purpose of the alert is to prevent accidental deletion of cell contents. It could say something like "Are you sure you want to delete the contents of this cell?" It would then give the choice of answering Yes or No. Is there an option I can choose somewhere? Many thanks Matthew

  2. #2
    Forum Contributor
    Join Date
    01-06-2015
    Location
    Huntsville, AL
    MS-Off Ver
    Office 365
    Posts
    185

    Re: Alert before deleting contents of a cell

    I wish I knew the answer for you, but I do know it has to be done with VBA code. If you upload a sample sheet and make sure you list the cells that you want that option on, someone on here could easily tell you how to make it work.

  3. #3
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Alert before deleting contents of a cell

    Hi DutyManager

    Try the code below & see if it does what you need
    Right click a sheet tab, click view code & paste the code below in the window.

    Attached is a demo workbook for you to test
    I can't attach files on this forum, a dropbox link does it nicely

    Cheers

    Please Login or Register  to view this content.
    https://www.dropbox.com/s/hh31iotqb0...firm.xlsb?dl=0

  4. #4
    Registered User
    Join Date
    02-28-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    100

    Re: Alert before deleting contents of a cell

    Hi.

    I have added your code on the attached worksheet and tried. But it doesn't works. Pls let me know whats the mistake i have done!

    Thanks.
    Thilak N
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Alert before deleting contents of a cell

    Hi Perpectuals

    1) It does work as it's supposed to. I admit I didn't explain in my post that as it is it protects cell G4 only.
    2) Don't hijack other peoples threads. Start your own

    Cheers

  6. #6
    Valued Forum Contributor
    Join Date
    08-22-2011
    Location
    Auckland
    MS-Off Ver
    Excel 2019
    Posts
    716

    Re: Alert before deleting contents of a cell

    Hi DutyManager

    Here is another version that's easier to understand. Add or delete to the Intersect code as necessary for the cells you wish to protect
    I put the code in sheet 2 of the workbook for the previous post. So sheet 1 & 2 have code for you to look at
    I forgot to cancel the error control in the sheet 1 code post above but it's added to the sheet 1 code in the download file
    Any problems, post a demo workbook so I can see what's what

    Cheers

    Please Login or Register  to view this content.
    Last edited by Philb1; 02-27-2016 at 11:33 PM. Reason: Forgot to add the code

+ 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. [SOLVED] Edit Cell Contents by Deleting the First Four Characters
    By suddebusse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2015, 09:53 PM
  2. Deleting cell contents within a range
    By aaron.irvine in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-16-2013, 08:16 PM
  3. When deleting cell contents, they come right back?
    By Paul987 in forum Excel General
    Replies: 3
    Last Post: 03-24-2008, 02:08 PM
  4. Replies: 2
    Last Post: 03-31-2007, 06:59 AM
  5. [SOLVED] Deleting rows dependent upon cell contents
    By daedalus1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-25-2005, 10:05 AM
  6. Replies: 4
    Last Post: 03-28-2005, 05:06 PM
  7. Replies: 7
    Last Post: 03-27-2005, 08:06 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