IF statement to check the formula in a cell

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.
 
J

Jack Houben

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.
 

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