View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phyllis Phyllis is offline
external usenet poster
 
Posts: 34
Default Excel events appearing unexpectedly


OssieMac,

That suggestion worked great and allowed me to insert rows in the middle of
the range without invoking the combobox event. Thank you.

"OssieMac" wrote:

Hi Phyllis,

I suspected something similar that was causing the event to fire and hense
my reason for asking to see the code. However, try turning off events while
the code is making the changes that are causing the problem.

Private Sub Worksheet_Change(ByVal Target As Range)
'Insert following prior to code causing event
'to fire
On Error GoTo ReEnableEvents
Application.EnableEvents = False

'Your other code in here


'Insert following after your other code.
ReEnableEvents:
Application.EnableEvents = True
End Sub

If you use the above and for any reason the code stops before reenabling the
events then the events remain turned off until you either turn them back on
with code or restart excel. Therefore, insert the following sub somewhere and
just place the cursor in the sub and press F5.

Sub Re_Enable_Events()
Application.EnableEvents = True
End Sub

--
Regards,

OssieMac