Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I hope this is not a dumb question!
in some event codes I see in the beginning the code statement application.enableevents=false and then at the end application.enableevents=true are these two statements (I understnad if one is there the otehr should be there) necessary and why? Thanks and regards. mine excel 2002(windows xp) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For example, if you have code inside a WorkSheetChange event that changes
the worksheet then it would trigger the WorkSheetChange code again: Private Sub Worksheet_Change(ByVal Target As Range) ActiveCell = ActiveCell + 1 End Sub So my question is, why doesn't this cause an endless loop? It stops when activecell value hits 227. Doug "R..VENKATARAMAN" wrote in message ... I hope this is not a dumb question! in some event codes I see in the beginning the code statement application.enableevents=false and then at the end application.enableevents=true are these two statements (I understnad if one is there the otehr should be there) necessary and why? Thanks and regards. mine excel 2002(windows xp) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() In most case yes - it stops the macro retriggering itself In the following example the macro will run everytime any cell is changed even when the macro changes a1 Private Sub Worksheet_Change(ByVal Target As Range) range("a1").value=target.address & " Changed" End Sub In the follwing example the macro changing a1 does not trigger a fresh update to a1 Private Sub Worksheet_Change(ByVal Target As Range) application.enableevents=false range("a1").value=target.address & " Changed" application.enableevents=true End Sub -- mudraker ------------------------------------------------------------------------ mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473 View this thread: http://www.excelforum.com/showthread...hreadid=536685 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.EnableEvents | Excel Worksheet Functions | |||
need programming help with nested event codes | Excel Programming | |||
Linking worksheet event codes | Excel Worksheet Functions | |||
Application.EnableEvents = true, but no event fires | Excel Programming |