Run MACRO from the valve of a cell?

  • Thread starter Thread starter FX Boudreaux
  • Start date Start date
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.
 
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
 

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

Back
Top