Excel Cell Color Shortcut: Change Background Color
Quick Answer In Microsoft Excel for Windows, press Alt + H, H to open the Fill Color palette. Use the arrow keys to select a background color and press Enter...
Quick Answer
In Microsoft Excel for Windows, press Alt + H, H to open the Fill Color palette. Use the arrow keys to select a background color and press Enter to apply it to the selected cell or range. This lets you change cell colors without clicking the Fill Color button with your mouse.
If you frequently use the same color, you can also repeat a previous formatting action with F4 or Ctrl + Y, when Excel supports repeating that action. For a dedicated shortcut that always applies a particular color, you can create a VBA macro and assign it a keyboard shortcut.
Method 1: Change Cell Background Color Using the Keyboard
Use this method when you want to choose a color from Excel's built-in Fill Color palette without using the mouse.
- Select the cell or range of cells you want to format.
- Press Alt + H, H in sequence. Do not hold all the keys simultaneously: press Alt, then H, then H.
- Use the arrow keys to navigate the available theme colors and standard colors.
- Press Enter to apply the highlighted color.
Example: To give cell A1 a yellow background, select A1, press Alt + H, H, navigate to the required yellow shade, and press Enter.
Important: The exact palette navigation depends on your Excel version and the selected color palette. Check the highlighted color before pressing Enter.
Method 2: Repeat the Last Fill Color
If you have already applied a fill color and want to use the same formatting on another cell, try Excel's Repeat command.
- Select a cell and apply the required fill color using Alt + H, H.
- Select another cell or range that should receive the same formatting.
- Press F4 or Ctrl + Y to repeat the previous action, if supported in your Excel version and context.
On some keyboards, you may need to press Fn + F4 because the function keys control hardware features by default.
Limitation: F4 and Ctrl + Y do not guarantee that Excel will apply the last fill color in every situation. They repeat the last repeatable action, which may be a different operation. Test the result before applying it to a large range.
Method 3: Create a Dedicated Shortcut for a Specific Color
If you regularly apply the same background color, a VBA macro can apply a predefined color directly to selected cells. You can assign a keyboard shortcut such as Ctrl + Shift + Y to the macro.
This method is useful when you want a dedicated shortcut for yellow, green, red, or another specific color rather than choosing from the palette each time.
Step 1: Open the VBA Editor
- Open your Excel workbook in the desktop version of Excel.
- Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
- In the VBA editor, select Insert > Module.
Step 2: Add the Macro Code
Copy the following code into the module. This example applies a yellow background to the currently selected cells.
Sub FillYellow()
If TypeName(Selection) = "Range" Then
Selection.Interior.Color = RGB(255, 255, 0)
End If
End Sub
The macro uses the VBA Interior.Color property to set the selected cells' background color. The RGB values specify red, green, and blue components; 255, 255, 0 represents yellow.
Step 3: Assign a Keyboard Shortcut
- Return to Excel.
- Open the Developer tab and select Macros. If the Developer tab is not visible, enable it through File > Options > Customize Ribbon and select Developer.
- Select FillYellow and click Options.
- In the Shortcut key field, enter an uppercase Y to assign Ctrl + Shift + Y.
- Click OK and close the dialog boxes.
Microsoft Excel uses Ctrl + a lowercase letter for a macro shortcut entered as lowercase, and Ctrl + Shift + a letter when an uppercase letter is entered. Avoid assigning shortcuts that conflict with existing Excel commands.
Step 4: Save the Macro
To keep the macro in the current workbook, save the file as an Excel Macro-Enabled Workbook (.xlsm). If you save it as a standard .xlsx file, VBA macros are not retained in that file.
If you want to use the shortcut in multiple workbooks, you can store the macro in your Personal Macro Workbook (PERSONAL.XLSB), which loads when Excel starts. Make sure macros are permitted by your organization's security policy.
Using the Custom Shortcut
- Select one or more cells.
- Press Ctrl + Shift + Y.
- Confirm that the selected cells now have a yellow background.
To use a different color, change the RGB values in the macro. For example, RGB(0, 255, 0) produces bright green, while RGB(255, 0, 0) produces red.
Method 4: Use the Quick Access Toolbar
If you prefer not to use VBA, you can add frequently used commands to Excel's Quick Access Toolbar and access them through keyboard navigation.
- Open the Quick Access Toolbar customization menu.
- Add relevant commands if they are available in the customization list.
- Use the Alt key to display keyboard access keys and follow the displayed key prompts.
The Fill Color command may not be available as a separate one-click color choice in every toolbar configuration. This method is therefore less suitable than a VBA macro when you need a specific color applied immediately.
Which Method Should You Use?
| Requirement | Recommended method |
|---|---|
| Choose a different color from the standard palette | Alt + H, H, then use the arrow keys |
| Repeat the last formatting action | F4 or Ctrl + Y, when the action is repeatable |
| Apply the same specific color with one shortcut | VBA macro with an assigned shortcut |
| Avoid macros and use keyboard navigation | Fill Color palette or Quick Access Toolbar |
How to Verify the Shortcut
- Test the shortcut on a blank or unimportant cell first.
- Check that the background color changes as expected.
- If you use a macro, confirm that the macro is enabled and that the shortcut is assigned correctly.
- If the color does not change, check whether the worksheet is protected, whether the selection contains cells, and whether your Excel environment permits VBA macros.
Common Problems
Alt + H, H Does Not Open the Color Palette
Make sure you are using desktop Excel and pressing the keys in sequence. Keyboard access keys can differ in other spreadsheet applications and may behave differently in Excel for the web or on Mac.
F4 Repeats the Wrong Action
F4 repeats the last action that Excel recognizes as repeatable. If another action occurred after the fill operation, F4 may repeat that action instead. Use the Fill Color palette again or configure a dedicated macro shortcut.
The Macro Shortcut Does Not Work
- Confirm that the workbook containing the macro is open.
- Check the macro name and shortcut assignment in Developer > Macros > Options.
- Confirm that the workbook is saved in a macro-enabled format if the macro is stored in that workbook.
- Check whether security settings or organizational policies block macros.
Frequently Asked Questions
What is the shortcut to open Fill Color in Excel?
In Excel for Windows, press Alt + H, H in sequence to open the Fill Color palette.
Can I apply a cell background color without using the mouse?
Yes. Use Alt + H, H and the keyboard arrow keys to choose a color. For a specific predefined color, use a VBA macro with an assigned shortcut.
Is there a single default shortcut for applying any chosen cell color?
Excel does not provide one universal default shortcut that directly applies every possible fill color. The built-in keyboard sequence opens the palette, while a custom macro can apply a specific color immediately.
Can I use the same shortcut for multiple cells?
Yes. Select a range of cells before opening the Fill Color palette or running the macro. The selected cells will receive the chosen or predefined background color.
Does the VBA macro work in Excel for the web?
VBA macros cannot be created, edited, or run directly in Excel for the web. Use the desktop version of Excel to run VBA macros. Keyboard access keys may be available in Excel for the web, but the exact behavior can differ.
Will the macro change the cell text or values?
The example macro changes the selected cells' interior fill color only. It does not intentionally change their values, formulas, or font color.
Can I use this shortcut on Excel for Mac?
Some Excel keyboard shortcuts differ between Windows and Mac. The VBA macro shortcut assignment also uses different modifier-key behavior on Mac. Check the Microsoft documentation for your Excel version before relying on a particular key combination.
Conclusion
For occasional color changes, use Alt + H, H and select the desired color with the keyboard. For repeated use of the same color, try F4 or Ctrl + Y when the previous action is repeatable. If you need a dedicated shortcut that applies a specific background color immediately, a VBA macro is the most flexible option in desktop Excel.
Sources
Was this guide useful?
Your answer helps us keep BISONKB accurate and practical.