ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run MACRO from the valve of a cell? (https://www.excelbanter.com/excel-programming/306740-run-macro-valve-cell.html)

FX Boudreaux

Run MACRO from the valve of a cell?
 
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.

--
Francis X. Boudreaux


Frank Kabel

Run MACRO from the valve of a cell?
 
Hi
you'll need an event procedure for this. See:
http://www.cpearson.com/excel/events.htm

--
Regards
Frank Kabel
Frankfurt, Germany


FX Boudreaux wrote:
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.


mark

Run MACRO from the valve of a cell?
 
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


-----Original Message-----
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.

--
Francis X. Boudreaux



All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com