Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_Change or Worksheet_SelectionChange
How do I keep Worksheet_Change from getting caught in a loop.
I use this Worksheet Event for a User to enter their ID in a Cell, the program actually queries a database and returns records that fill into 4 other cells. When I debug the code I notice it gets caught in a loop. When the records fill into the 4 cells, the Worksheet_Change is triggered and it goes round and round. How do I stop this? I get the same problem with Worksheet_SelectionChange. Please help. Much thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_Change or Worksheet_SelectionChange
Disable events while your code is running eg
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ErrorHandler Application.EnableEvents = False 'do whatever ErrorHandler: Application.EnableEvents = True End Sub Hope this helps Rowan Bret wrote: How do I keep Worksheet_Change from getting caught in a loop. I use this Worksheet Event for a User to enter their ID in a Cell, the program actually queries a database and returns records that fill into 4 other cells. When I debug the code I notice it gets caught in a loop. When the records fill into the 4 cells, the Worksheet_Change is triggered and it goes round and round. How do I stop this? I get the same problem with Worksheet_SelectionChange. Please help. Much thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet_Change or Worksheet_SelectionChange
Application.EnableEvents = False
code to enter data Application.EnableEvents = True -- Regards, Tom Ogilvy "Bret" wrote in message ... How do I keep Worksheet_Change from getting caught in a loop. I use this Worksheet Event for a User to enter their ID in a Cell, the program actually queries a database and returns records that fill into 4 other cells. When I debug the code I notice it gets caught in a loop. When the records fill into the 4 cells, the Worksheet_Change is triggered and it goes round and round. How do I stop this? I get the same problem with Worksheet_SelectionChange. Please help. Much thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet_SelectionChange | Excel Programming | |||
Worksheet_SelectionChange | Excel Programming | |||
Worksheet_SelectionChange | Excel Programming | |||
worksheet_change vs. calculate, and worksheet_change not running | Excel Programming | |||
worksheet_change vs. calculate, and worksheet_change not running | Excel Programming |