Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 07-12-2017, 04:29 PM
NoSparks NoSparks is offline msgbox when deleting cells Windows 7 64bit msgbox when deleting cells Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

If the message box is a must, you need the normal means of deleting the cell contents to initiate it.

As ArviLaanemets says, the Change event firing every time something changes will slow down your worksheet
but depending on the worksheet that may or may not be an issue.

Put this code into the sheet module and give it a try.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim aCell As Range

For Each aCell In Target.Cells
    If aCell.Value = "" Then
        If MsgBox("Are you sure you want to " & _
          "delete cell contents ?", 36, "DELETE CELLS ?") <> vbYes Then
              Application.EnableEvents = False
              Application.Undo
              Application.EnableEvents = True
        End If
    End If
    Exit For
Next aCell

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
msgbox when deleting cells Trigger Beep or MsgBox when key combo accidentally pressed NotQuiteANovice Word VBA 1 04-07-2017 05:41 PM
msgbox when deleting cells Deleting rows based on the text in certain cells VBA ThisGuyJohn Excel Programming 5 02-03-2017 03:16 PM
msgbox when deleting cells On Open MsgBox for use in Template sent out to colleagues to gather information Lancashire Lad Word VBA 2 10-26-2015 10:22 AM
Deleting info from specific table cells jamierbooth Word VBA 3 07-29-2014 03:20 PM
msgbox when deleting cells Make MsgBox appear... Jamtart PowerPoint 3 09-01-2012 08:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft