bottom
Excel 2007 Tips!
     
Your e-mail address is safe!
Close Note
excel2007.Tips.Net Welcome toExcel2007.Tips.Net

Helpful Links

Excel 2007 Home
Tips.Net Home

Ask a Question
Make a Comment

Bugs and Pests Tips
Car Tips
Word2007 Tips
WordTips

Newest Tips

Negative Elapsed Times

Specifying the Number of MRU Files

Changing Data Series Ordering

Seeing How Excel Evaluates Formulas

Highlighting a Cell if It Contains Specific Text

Filling Shapes with Pictures

Creating a List of Worksheet Formulas

 

Highlighting Cells Containing Formulas

Summary: One of the nifty purposes to which you can put conditional formatting is highlighting cells with different types of contents. This tip explains how you can use the tool to highlight cells that contain formulas.

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:

  1. With the Home tab of the Ribbon displayed, click the Conditional Formatting option in the Styles group. Excel displays a palette of options related to conditional formatting.
  2. Choose Highlight Cells Rules and then choose More Rules from the resulting submenu. Excel displays the New Formatting Rule dialog box.
  3. In the Select a Rule Type area at the top of the dialog box, choose Use a Formula to Determine Which Cells to Format. (Click here to see a related figure.)
  4. In the Format Values Where This Formula Is True box, enter "=HasFormula(A1)" (without the quote marks). If the active cell in the range that you selected is not A1, you'll need to modify the formula slightly to reflect whatever cell is active.
  5. Click Format to display the Format Cells dialog box.
  6. Use the controls in the Format Cells dialog box to specify how you want the cells formatted.
  7. Click OK to close the Format Cells dialog box.
  8. Click OK.