Delete key not activating Worksheet_Change procedure

BigDelGooner

Board Regular
Joined
Aug 17, 2009
Messages
197
Hi all

The code below works fine when I change a value in cells B6,B7 or B8 but when I delete a value in these cells using the delete key the procedure is not activated. I presume its that the delete key command is effectively classed as a ClearContents and not an actual change, any ideas on a workaround for this though?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$6" Then
FrontPage_Summary
End If

If Target.Address = "$B$7" Then
FrontPage_Summary
End If

If Target.Address = "$B$8" Then
FrontPage_Summary
End If
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi all

...but when I delete a value in these cells using the delete key the procedure is not activated. I presume its that the delete key command is effectively classed as a ClearContents and not an actual change, any ideas on a workaround for this though?...

Hi there,

Somethiing is goofy, as ClearContents is indeed a change. In fact, you can enter and exit edit mode (F2) and a change will be registered, even though you didn't change anything.

Mark
 
Upvote 0
Strange.

Actually the values in cells B6, B7 and B8 are selected from data validation list, does this still work on your side?
 
Upvote 0
If I run a simple code like this it will react to the Delete key and pop a messagebox if you delete contents. In fact it triggers
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

MsgBox Target.Address

End Sub
And I was beaten to the punch by a lot of people! Darn testing before typing.


Edit:
If I make a simple datavalidation lists the messagebox triggers on each change/delete.
 
Last edited:
Upvote 0
Thank you so much for all the responses.

This is very strange because if i change the code to the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$6" Then
FrontPage_Summary
End If

If Target.Address = "$B$7" Then
FrontPage_Summary
End If

If Target.Address = "$B$8" Then
FrontPage_Summary
End If

MsgBox Target.Address

I can hit the delete key in cells B6,B7 or B8 and I get the msgbox but it doesn't execute the FrontPage_Summary procedure...?!

End Sub
 
Upvote 0
Place a breakpoint on the first line (place the cursor on the line and hit F9):

If Target.Address = "$B$6" Then

then go and select one of your cells (B6) and hit Delete. Then step thru the code in the VBE sign F8 and see if your code is actually getting activated.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top