How do you check whether a formula exists in a cell or not?

A

AllanW

I need to be able to check whether a cell contains a formula or not.
Does anyone know of a function which can perform this check?

Thanks.
 
F

Frank Kabel

Hi
you can use a UDF:
Function IsFormula(Cell As Range) As Boolean
IsFormula = Cell.HasFormula
End Function

HTH
Frank
 
F

Freemini

One way to select all formulae is to use Edit > Goto > Special and the
to check the box for formula, unchecking any that are not required i.e.
Logical

This will highlight all formula cell, choose a fill colour and all
formula cells will be filled.

You could use a different fill colour for different types of formula.

HTH

Mike
 
H

Hank Scorpio

I need to be able to check whether a cell contains a formula or not.
Does anyone know of a function which can perform this check?

Strangely none of the information functions seem to show that (as far
as I can recall, anyway). However it's easy enough to build your own.
Copy this into a standard module:

Function DoesCellHaveFormula(rng As Range) As Boolean

If rng.HasFormula Then
DoesCellHaveFormula = True
End If

End Function

Then you can just use it as you would any other worksheet function,
like so:

=DoesCellHaveFormula(C4)
 
Top