Can Excel Conditional Formatting Change Font Size or Row Height?
Question details
The user wants to know if they can automatically change font size or row height using conditional formatting in Excel based on a specific cell value.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Formatting a report where rows need to automatically shrink or adjust their font size when a specific condition (such as a status changing to 'Completed') is met.
- Observed behavior
- Native Excel conditional formatting supports changing visual properties like font color, fill, and borders, but lacks the ability to alter layout dimensions like font size or row height.
Ensure your workbook is saved as a Macro-Enabled Workbook (.xlsm) if you plan to use VBA scripts, as standard conditional formatting cannot adjust physical cell dimensions.
Use VBA to Change Row Height and Font Size
Since native conditional formatting doesn't support layout size changes, a VBA macro is required to automate row height and font size adjustments based on cell values.
VBA (Visual Basic for Applications) can detect when a cell's value changes and automatically trigger formatting updates across the sheet, overriding the limitations of standard conditional formatting rules.
Press 'Alt + F11' on your keyboard to open the VBA Editor in Excel.
In the Project Explorer panel on the left, right-click the name of the sheet where you want this formatting applied and select 'View Code'.
Paste a 'Worksheet_Change' script that targets the specific column (e.g., Column E). Program the script to check if the target cell's value equals your condition (e.g., 'Completed').
Add commands within your script such as 'Target.EntireRow.RowHeight = 15' and 'Target.Font.Size = 8' to apply the formatting changes when the condition is met.
Go to File > Save As, and change the file format to 'Excel Macro-Enabled Workbook (*.xlsm)' to ensure your automation works.

Use Standard Conditional Formatting for Supported Visuals
If you want to avoid using macros, use built-in conditional formatting to visually distinguish cells using supported properties like font styles, colors, or borders.
Manually Adjust Rows or Use AutoFit
For one-off reports where automation isn't strictly necessary, manually format the completed rows or use AutoFit to match font changes.
Use WPS Spreadsheet to Automate and Format Data
WPS Spreadsheet offers powerful conditional formatting tools and comprehensive VBA support, allowing you to dynamically manage font sizes, row heights, and visual styles easily.
- 1. Open Your Spreadsheet: Launch WPS Spreadsheet and open your existing Excel workbook.
- 2. Apply Visual Rules: To apply visual highlights, select your data range and click 'Conditional Formatting' under the 'Home' tab.
- 3. Automate Physical Sizes via VBA: To automate layout sizes, go to the 'Tools' tab and click 'Macro' > 'Visual Basic Editor' to insert your dynamic resizing script.
- 4. Save and Execute: Save your document as a macro-enabled file (.xlsm) so the row heights and font sizes update automatically as cell values change.

Frequently Asked Questions
Why is font size grayed out in Excel Conditional Formatting?
Excel restricts font size and font type changes in conditional formatting to prevent unexpected shifts in row heights and overall spreadsheet layout. These layout shifts can drastically disrupt data alignment and make the spreadsheet difficult to read if triggered continuously.
Can Office Scripts change row height on Excel for Web?
Yes, if you are using Excel for the Web with an enterprise or business license, you can write TypeScript-based Office Scripts to automate row height and font size changes, serving as a modern alternative to VBA macros.
Is it possible to use an Excel formula to change cell size?
No, Excel formulas can only calculate and return values or text strings to the cell they reside in. They cannot change physical formatting, row height, column width, or the styles of any cells.




