
Tips.Net > ExcelTips Home > Formatting > Cell Formatting > Conditionally Highlighting Cells Containing Formulas
Summary: You can use conditional formatting for all sorts of things, including the highlighting of cells that contain formulas. This tip explains how you can do this, with the assistance of a short user-defined function. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)
You probably already know that you can select all the cells containing formulas in a worksheet by pressing F5 and choosing Special | Formulas. If you need to keep a constant eye on where formulas are located, then repeatedly doing the selecting can get tedious. A better solution is to use the conditional formatting capabilities of Excel to highlight cells with formulas.
Before you can use conditional formatting, however, you need to create a user-defined function that will return True or False, depending on whether there is a formula in a cell. The following macro will do the task very nicely:
Function HasFormula(rCell As Range) As Boolean
Application.Volatile
HasFormula = rCell.HasFormula
End Function
To use this with conditional formatting, select the cells you want checked, and then follow these steps if you are using a version of Excel prior to Excel 2007:
If you are using Excel 2007 then you should follow these steps, instead:
Tip #3188 applies to Microsoft Excel versions: 97 2000 2002 2003 2007
Save Time and Money! Many people need to keep track of employee time, but don't know where to start when it comes to creating a spreadsheet. Here's a way to save time, effort, and money with ready-to-use timesheet templates.
Check out Timesheet Templates today!
If you have tons of data to analyze, one of the best tools in Excel's arsenal is the PivotTable. Learn how to use this tool to analyze your data. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site