Run MACRO from the valve of a cell?

F

FX Boudreaux

Does anyone know if I can run a MACRO from the value of a cell?

If cell "A1" is greater the 42 I would like to either close the worksheet
with out saving or protect if from any more changes.
 
M

Mark

You will need an onsheet event.
Right click the sheet tab, view code.
Put this macro into the sheet module

Sub Doobee()
set a=range("A1")
if a.value > 42 then
activeworkbook.close false
'changes not saved

end if

end sub

Regards
Mark
 
Top