This is how to make Excel cells automatically highlight when you click on them—no VBA required. The built-in "conditional formatting" feature lets you apply colors or patterns on hover or focus, but clicking directly triggers a simple workaround: use a VBA macro or a formula-based workaround that toggles formatting dynamically. If you can’t write macros, a workaround with keyboard shortcuts or built-in tools may suffice, though performance varies. What you’ll need depends on your version (Excel 2016+ supports built-in hover effects, while older versions require manual coding).
What You'll Need
- Excel 2016 or later (hover/formatting on click is natively supported in newer versions). For older versions, you’ll need a working computer and a blank worksheet (or data you can modify).
- VBA editor access (in Excel, press
Alt + F11to open the VBA editor). Older versions may require a compatible version of VBA. - If avoiding VBA: a keyboard shortcut (Ctrl+Shift+F11 for conditional formatting triggers) and basic formula knowledge.
Step-by-Step
- Method 1: Use Built-In Conditional Formatting (Works in Excel 2016+)
- Select the cell or range you want to highlight on click.
- Go to the Home tab, then click Conditional Formatting > New Rule.
- Choose Format only cells that contain and select Blank (this creates a formatting trigger for empty cells on click).
- Click Format, choose a fill color in the Format Cells dialog, then click OK twice.
- If the effect doesn’t appear on click, try enabling the Formatting on Focus option (in newer versions, it may appear under Home > Conditional Formatting > Manage Rules > New Rule > Format cells with formula... and selecting Format only cells that meet this condition: current cell is focused).
- Method 2: VBA Macro (Works in All Versions)
- Open the VBA editor by pressing
Alt + F11. In the Project Explorer, double-click ThisWorkbook. - Paste this code (adjust the range as needed):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Not Application.Intersect(Target, Me.Range("A1:A10")) Is Nothing Then Target.Interior.Color = RGB(255, 204, 153) ' Light orange color End If Cancel = True End Sub - Replace
A1:A10with your desired range. Save the file (clickAlt + F11>Project>Save All). - Click inside the selected cells—now they’ll turn orange on click.
- Open the VBA editor by pressing
- Method 3: Keyboard Shortcut Workaround (No VBA)
- Select the cells you want to highlight.
- Press
Ctrl + Shift + F11to open conditional formatting. Choose Format only cells containing > Blank, then apply a fill color. - To trigger a click effect, set a macro to run a key combo (e.g.,
Ctrl + Space) that highlights cells. Use a tool like AutoHotkey for system-wide shortcuts, but note this bypasses Excel’s direct interaction.
Common Mistakes
- Macro not working? Ensure the macro runs in the Worksheet_BeforeDoubleClick event. Older Excel versions (
Excel 2010) may require changing the event toWorksheet_SelectionChange(less reliable). - Built-in formatting unhighlighting? Conditional formatting resets when the sheet loses focus. For persistent highlighting, use VBA or add a second rule (e.g., blank cells).
- Keyboard shortcuts interfering? Test with
Ctrl + Spacefirst to avoid accidental triggers.
Tips
- For dynamic ranges, dynamically adjust the VBA range using
ActiveCell.EntireRowin the macro to highlight cells in the clicked row. - Use
Application.EnableEvents = Falsebefore macros to prevent accidental triggers (e.g., when opening a file). - Test in a blank sheet first—some macros may conflict with existing data.
- In older Excel versions (
2007), replaceIntersectwithIf Target.Cells.Count = 1 Thento avoid range errors.
Troubleshooting
- If the macro doesn’t run:
- Check for errors by pressing
F8to step through the code. - Run the macro manually by pressing
Alt + F8, selecting ThisWorkbook, and clickingBeforeDoubleClick. - Ensure macros are enabled: Go to File > Options > Trust Center > Trust Center Settings > Macro Settings > Enable all macros.
- Check for errors by pressing
- If built-in conditional formatting doesn’t highlight on click:
- Enable Formatting on Focus under Advanced formatting options (older versions may require adding a custom rule for focus detection).
- Try a
Format Cells with Formularule: Use=IF(SELECTED_CELL="", TRUE, FALSE)to force a trigger on click.
- If performance lags:
- Optimize the VBA macro by adding a
On Error Resume Nextwrapper. - Avoid highlighting large ranges simultaneously.
- Optimize the VBA macro by adding a
Frequently Asked Questions
How do I highlight cells on click in Excel 2013?
Excel 2013 lacks built-in hover effects. Use VBA with Worksheet_SelectionChange (less reliable) or install an add-in like Conditional Formatting Pro to simulate clicks. Avoid macros triggered by BeforeDoubleClick—they may fail on touch devices.
Can I highlight cells on click with just formulas?
Yes, but it’s limited. Use a formula like =IF(SELECTED_CELL="", RGB(255,204,153), RGB(255,255,255)) in a helper column to apply conditional formatting. This requires pressing Ctrl + Space to "click" the cell (not native interaction).
Why does the VBA macro turn all cells orange?
The macro checks all cells in the specified range. To fix, either:
- Replace
A1:A10with a dynamic range likeIntersect(Selection, Me.Range("A1:A10")), or - Modify the code to use
Target.Cells.Count = 1to target only single-clicked cells.
How do I remove the VBA highlighting?
In VBA, delete the macro from the ThisWorkbook module. If using a helper column, clear the conditional formatting rule. Avoid deleting the BeforeDoubleClick module entirely—it won’t cause errors but is unnecessary if removed.
Does this work on Excel for Mac?
No, VBA macros run differently on Mac Excel (uses VBA.NET). Use the built-in conditional formatting with a BeforeDoubleClick event (if available) or a third-party tool like ExcelBridge for cross-platform macros.
How can I avoid accidental triggers?
Add Application.EnableEvents = False at the start of your macro to disable all event triggers until the macro runs. Alternatively, test macros in a blank sheet.