Need Help on Macro That Assigns Command Key

Alex20850

Board Regular
Joined
Mar 9, 2010
Messages
146
Office Version
  1. 365
Platform
  1. Windows
Sub Certify()
Application.OnKey "+^(B)", "FixNow"
End Sub


Sub FixNow()
ActiveCell.value = Now
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I have tried different Ctrl key combinations in the code and then in the spreadsheet.
Instead of the macro being run, it does the shortcut.
 
Upvote 0
I have tried different Ctrl key combinations in the code and then in the spreadsheet.
Instead of the macro being run, it does the shortcut.

I'm not clear ...

If I run Sub Certify, as written, then any time I use the key combination Ctrl-Shift-B in that instance of Excel, Sub FixNow will run and put a timestamp in the ActiveCell.

It sounds like you're saying that Ctrl-B still toggles Bold on/off?
 
Upvote 0
I'm not clear ...

If I run Sub Certify, as written, then any time I use the key combination Ctrl-Shift-B in that instance of Excel, Sub FixNow will run and put a timestamp in the ActiveCell.

It sounds like you're saying that Ctrl-B still toggles Bold on/off?

I changed it to the following and Ctrl+a still works as a shortcut instead of running the macro.

Sub Certify()
Application.OnKey "+^(a)", "FixNow"
End Sub

Sub FixNow()
ActiveCell.value = Now
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,456
Messages
6,124,939
Members
449,197
Latest member
k_bs

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