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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

HarryB

New Member
Joined
Oct 10, 2004
Messages
1
Probably there is nothing wrong, but you did not realise that you defined the {ENTER} of the numeric keypad. Use "~" for the normal ENTER.
 

Forum statistics

Threads
1,181,093
Messages
5,928,040
Members
436,583
Latest member
AlxBtx

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
Top