Redefining Keyboard using VBA

AliCat

Board Regular
Joined
Aug 8, 2002
Messages
82
Hi folks,

I'm entering times on a sheet and to save my little fingers, I want to redefine the ENTER key on the numerick keypad to give me a COLON :)), but only in the specific workbook.

I've looked up the Help!!! and come away with the following code,

Sub OldKey()
Application.OnKey "{ENTER}", "NewKey"
End Sub

Sub NewKey()
Application.SendKeys (":")
End Sub

but it's not working.

Where am I going wrong.???

Help appreciated, thanks.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Probably there is nothing wrong, but you did not realise that you defined the {ENTER} of the numeric keypad. Use "~" for the normal ENTER.
 
Upvote 0

Forum statistics

Threads
1,221,383
Messages
6,159,540
Members
451,571
Latest member
Qwissy

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