How can I tell if a cell in Excel contains a number / text or a formula?
Just for reference (and for upvoting :-)), I finally solved auto 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 great for me. (Found here )
source to share
I realize it has been inactive for over a year, but given recurring comments about the hope of avoiding VBA I, even though it was worth posting XLM using the Range Names approach.
based on code by David Hager from http://j-walk.com/ss/excel/eee/eee003.txt
- Determine the name of the range. IsFormula refers to: = GET.CELL (48, INDIRECT ("rc", FALSE))
- Add a conditional formatting rule "using a formula to determine which cells to format" = IsFormula in the range of interest and choose a color
And you're done
The historical advantage of using XLM was that it allowed VBA code to be coded without providing macros. The presence of XLM now contains a warning about such content, but it is still useful to use these XLM conditional formatting tricks without having to trigger a VBA event in the background.
I wrote a longer article on using XLM / Range Names / Conditional Formmating to define external cell references, page references, formulas, etc. and the inconsistent formulas at http://www.experts-exchange.com/A_7629.html (note that this is outside of the EE payment system, it's freely available without participation)
source to share