Consulting | Excel Examples

Highlight Exception Values

Keywords: OnEntry, Font, ColorIndex, If, Exception

Description: This example displays a date less that the current date in red. It uses a Visual Basic for Applications procedure to set the color of the text.

Tip: You can use the OnEntry property to run an exception check. The procedure can change the font color of the cell and can perform an operation on the ActiveCell if you want to validate or change color cell where data is entered. There is a "hole" in the logic of OnEntry: when the user copies a cell and pastes the value on the worksheet the OnEntry property does not run.

Guide to the Example: Enter a date in cell A10 on Sheet1. If the date is less than the current date, the text color will show as red. If the date is equal to or greater than the current date, the text will show as black.

Download File: Click Here
Tip: Click on the link above and choose "Save" to download the xls workbook to your hard drive or "Open" to open the workbook inside of your browser.


Last modified: May 21, 1996