how do i shade cells that contain a formula

P

peter

It seems like it should be possible to do this with conditional formatting,
but i can't find a function that detects whether a cell contains a formula.
any help on this is much appreciated. thanks.
 
G

Gord Dibben

peter

Paste this UDF to a general module in your workbook.

Function IsFormula(Cell)
Application.Volatile
IsFormula = Cell.HasFormula
End Function

Format>Conditional Formatting>Formula is: =IsFormula(A1)

Pick a pattern and OK your way out.

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.


Gord Dibben Excel MVP
 
S

Sweep

A slightly different approach..

With cell A1 selected, create a named range such as IsAFormula
referencing

=GET.CELL(6,A1)

[NB no dollar signs)

Select the whole sheet, and enter conditional formatting to respond t
the formula

=LEFT(IsAFormula,1)="="
 
Top