Copying Worksheet triggers Click event of combobox

  • Thread starter Thread starter Copying Worksheet triggers click event on combobox
  • Start date Start date
C

Copying Worksheet triggers click event on combobox

Hello,
I have worksheet("stuff") it has a combobox with a
click or change event. I have a worksheet("Template") I
make a copy of it with code or by hand.

The comboboxs in workSheet("Stuff")click or change events
fire off.

I have tried Application.EnableEvents = False.
Still the combobox events fire.

Any Idea how to stop this?
 
Posting reply only to cut down length of "last poster" - Nice job by the
way, Mr. Copying Worksheet triggers Click event of combobox.
 
EnableEvents is in the Excel object model. Comboboxes are in the MSForms
object model, so enableevents does not affect their events. You could set
up the events to look at a global variable and exit if it is set, then set
it before you do the copy.

In a general module

Public HaltEvent as Boolean

Sub Preventevent()
HaltEvent = True
End Sub
Sub AllowEvent()
HaltEvent = False
End Sub


in the event code

Private Sub combobox1_click()
if HaltEvent then Exit Sub
' existing code
End Sub
 
Back
Top