vba - Worksheet change, selection change, before doubleclick stop working -
on sheet have worksheet change, selection change , before doubleclick macros. work charm stop working. don't trigger @ all, when thing must trigger them.
when stop trigger : 1. if write macro like
sub test msgbox "hello" & application.enableevents end sub and play macro, works , show me "hello true".
if add msgbox "hello" @ first line in worksheet change macro, , test thing must trigger it, nothing happen.
if close workbook , reopen it, works again charm.
i don't know can stop these macro. though if application.events return "true" these macros must trigger (and cause errors, must trigger). test stop them ? ?
add code worksheet:
private sub worksheet_change(byval target range) thisworkbook.worksheets("sheet1").range("a1") = _ thisworkbook.worksheets("sheet1").range("a1") + 1 end sub now enter number 1 in cell a1. fire worksheet change event, add 1 value in cell a1, fire worksheet change event, add 1 value in cell a1.....
now @ code:
private sub worksheet_change(byval target range) application.enableevents = false thisworkbook.worksheets("sheet1").range("a1") = _ thisworkbook.worksheets("sheet1").range("a1") + 1 application.enableevents = true end sub now enter 1 in cell a1. event watching turned off, 1 added value in cell a1 , because event watching turned off - nothing else happens except turned on again after event have fired.
Comments
Post a Comment