#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Onkey Error

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnKey disabled by Excel at times? danhattan Excel Discussion (Misc queries) 4 August 29th 07 01:21 AM
onkey method freekrill Excel Discussion (Misc queries) 1 October 12th 05 01:31 PM
Onkey vs Macro Short cut key rgarber50 Excel Discussion (Misc queries) 1 July 10th 05 07:34 PM
Onkey Jase Excel Programming 1 November 17th 03 11:07 PM
OnKey for Alt f not overriding standard use of Alt-F Tim Richardson[_2_] Excel Programming 1 October 6th 03 12:54 AM


All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"