IF statement to check the formula in a cell

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

You will need to use a User Defined Function such as this
one, entered into a VBA module.

Public Function CellFormula(CellAddress As Range) As String
CellFormula = CellAddress.Formula
End Function

Then in your worksheet, enter:
=IF(CellFormula(C30)<>"=IF(B1=0,C1*1.19,B1*C1)","Check
formula in C30","")

You really should try to protect any cells containing
formulas though. You can unprotect only the cells that
the user needs to change. Simply select the cells that
the user needs to change, right-click, select Format
Cells, select the Protection tab, then uncheck the Locked
option. Then protect the sheet. This is probably the
best solution, because then you don't have to worry about
having to reset altered formulas.
 
Thanks Mike!

That did the trick.

Had a little problem to get it to work though, didn't realise I had to add a
module...
Now it works fine.

Thanks again.
 
Back
Top