Hot Keys for colors

mbkogan2

New Member
Joined
Jul 3, 2019
Messages
2
Hi,

Is it possible to set custom hot keys for colors? For example, instead of Alt+H+H and then arrow keying to the color I want to select, is there a way to set Alt+H+H+1 to, say, white, and Alt+H+H+2 to black, Alt+H+H+3 to the third color in the palette, etc.?

Thanks!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
.
You'll want to search for ONKEY. There are tons of examples on the internet and this Forum.

Here is an example for you to review :

Code:
Option Explicit




Private Sub Workbook_Open()


Application.OnKey "N", "NoFill"
Application.OnKey "r", "InsertRowandCopy"
Application.OnKey "t", "PBCandTextbox"
Application.OnKey "y", "YellowHighlight"




End Sub

The above macro is located in the ThisWorkbook Module. When the WB is opened the OnKey commands are initialized and reference the various macros located in
regular module / s.

This example shows a single key press for running the macro. You can edit the code to utilize multi-key presses as you indicated in your post.

Here is a link to download the workbook. Study it ... along with researching the Internet for OnKey :

https://www.amazon.com/clouddrive/share/DHDidJdUngSAhMeZixouEPQxE0nLrxMJpCaghUTGsFC
 
Upvote 0
Is there a way to do it without macros / VBA?



.
You'll want to search for ONKEY. There are tons of examples on the internet and this Forum.

Here is an example for you to review :

Code:
Option Explicit




Private Sub Workbook_Open()


Application.OnKey "N", "NoFill"
Application.OnKey "r", "InsertRowandCopy"
Application.OnKey "t", "PBCandTextbox"
Application.OnKey "y", "YellowHighlight"




End Sub

The above macro is located in the ThisWorkbook Module. When the WB is opened the OnKey commands are initialized and reference the various macros located in
regular module / s.

This example shows a single key press for running the macro. You can edit the code to utilize multi-key presses as you indicated in your post.

Here is a link to download the workbook. Study it ... along with researching the Internet for OnKey :

https://www.amazon.com/clouddrive/share/DHDidJdUngSAhMeZixouEPQxE0nLrxMJpCaghUTGsFC
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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