Thread: Onkey Error
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J.E. McGimpsey J.E. McGimpsey is offline
external usenet poster
 
Posts: 493
Default Onkey Error

One way:

Put ClearCell in a regular code module.


In article ,
"SuperJas" wrote:

Hi!

In trying to reassign the "Del" key to the "Backspace" key, I've tried to
program a procedure whenever the user presses "Delete".

I've placed the following lines of code within the Workbook_Activate event
(which, as usual, resides in the "ThisWorkbook" section):
-------------------------------------------
Application.Onkey "{DEL}", "ClearCell"
-------------------------------------------

and then wrote a new procedure, still within the "ThisWorkbook" section:
----------------------------
Sub ClearCell()
ActiveCell.ClearContents
End Sub
----------------------------

However, when I press the Delete key, Excel says that the macro couldn't be
found!

Could someone please help?

Thanks!

SuperJas.