ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to disable the delete key after deletion is made (https://www.excelbanter.com/excel-programming/321400-how-disable-delete-key-after-deletion-made.html)

susan hayes

How to disable the delete key after deletion is made
 
Hello again

If the user presses the delete key to delete something entered, my program executes which I dont want. How can you
simply have the value deleted and then exit sub for example so the program doesnt continue further.

I have tried

Application.OnKey "{delete}" ', "matrix" ' not quite what Im looking for

if .Value = vbKeyDelete Then ' this does nothing
Exit Sub
endif

Thanks
Mike


Myrna Larson

How to disable the delete key after deletion is made
 
Do you mean that you have a Worksheet_Change event macro that you don't want
to run if the user has cleared the cell? If so,

Private Sub Worksheet_Change(ByVal Target As Range)
If IsEmpty(Target.Value) Then Exit Sub
'your code goes here
End Sub


On Sat, 22 Jan 2005 14:56:21 -0500, Susan Hayes wrote:

Hello again

If the user presses the delete key to delete something entered, my program

executes which I dont want. How can you
simply have the value deleted and then exit sub for example so the program

doesnt continue further.

I have tried

Application.OnKey "{delete}" ', "matrix" ' not quite what Im looking for

if .Value = vbKeyDelete Then ' this does nothing
Exit Sub
endif

Thanks
Mike




All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com