views:

43

answers:

3

What I like to do is conditionally format cells depending on whether the cell contains a formula (something starting with "=") or not.

Is this feasible in Excel 2007?

+3  A: 

You can use:

If (cell.HasFormula) then ..

To look for formulas.

(This will avoid the problem of literal string field starting with an "=")

Alex K.
Thanks for the hint! I was trying to avoid VBA. But it seems not possible. Googling HasFormula brought up a second option I sketch below.
Karsten W.
+2  A: 

AFAIK, there is no readily accessible worksheet function or conditional to test for formulae. VBA offers the range.HasFormula method that returns true if every cell in the range (which can be a single cell) has a formula.

mpez0
+1  A: 

Just for reference (and for upvoting :-)), I finally solved the automatic coloring with VBA, without using conditional formatting:

dim ws as Worksheet
for each ws in thisworkbook.sheets
  ws.Cells.SpecialCells(xlCellTypeFormulas).Font.ThemeColor = xlThemeColorAccent1
next ws

works fine for me. (Found here)

Karsten W.