How to check whether a cell contains a formula or a value

  • Thread starter Eric Jan van de Veen
  • Start date
E

Eric Jan van de Veen

I would like to mark (f.i. by conditional formatting) cells that contain a
formula. In this way a user can deliberately choose to overwrite the value
genereted by the formula.
 
B

Bob Phillips

Add this simple UDF

Function IsFormula(rng As Range) As Boolean
IsFormula = rng.HasFormula
End Function

and a conditional formatting formula of
=IsFormula(A1)

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
N

Nick

Highlight a formula cell without code. Regards to Ian Brown FCA
([email protected])

Select cell A1 on any sheet in the workbook
Define the name CellHasFormula (using Insert | Name | Define) as
=GET.CELL(48,!A1)

In Format | Conditional Formatting use a "Formula Is" setting of
=CellHasFormula
to trigger the defined formats.

Apply the conditional formatting as required
 
B

Bob Phillips

But beware that if you copy this cell in XL2000 or earlier, you will crash
and burn.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top