How to disable the delete key after deletion is made

  • Thread starter Thread starter Susan Hayes
  • Start date Start date
S

Susan Hayes

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
 
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


Hello again

If the user presses the delete key to delete something entered, my program
executes which I dont want. How can you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top