ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Worksheet triggers Click event of combobox (https://www.excelbanter.com/excel-programming/289106-copying-worksheet-triggers-click-event-combobox.html)

Copying Worksheet triggers click event on combobox

Copying Worksheet triggers Click event of 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?


wesandem[_3_]

Copying Worksheet triggers Click event of combobox
 
Posting reply only to cut down length of "last poster" - Nice job by the
way, Mr. Copying Worksheet triggers Click event of combobox.


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

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

--
Regards,
Tom Ogilvy

Copying Worksheet triggers click event on combobox wrote
in message ...
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?





All times are GMT +1. The time now is 03:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com