test for a formula

L

lashio

Will someone help me write a macro to check if a selected cell contains a
formula. Please
 
N

Norman Jones

Hi Lashio,

Try something like:

'=================>>
Public Sub FormulaTest()
If ActiveCell.HasFormula Then
'Do something, e.g.:
MsgBox "Cell " & ActiveCell.Address(0, 0) _
& " is a formula cell"
Else
'do something else, e.g.:
MsgBox "Cell " & ActiveCell.Address(0, 0) _
& " is not a formula cell"
End If
End Sub
'<<=================
 
Top