Excel, VBA; OnChange event of a ComboBox
Posted on 2003-03-29
is it possible to temporarily disable the OnChange event of a combobox?
I have a userform with a combobox. The combobox gets its content from the
column A of my spreadsheet.
During runtime of this macro the content of the column A changes,
and unfortunately the event OnChange is launched.
I tried to avoid this problem with a code like this:
Dim ComboStatus as Boolean
Private Sub cbo_Change()
Dim SelectedThematics As String
Dim c As Range
If ComboStatus = True Then
' some code here
End Sub 'cbo_Change()
Private Sub btnSaveChanges_Click()
' Button on the same userform, together with the combobox
ComboStatus = False
' Some code here
End Sub ' Sub btnSaveChanges_Click()
Can you please tell me, why the OnChange event is executed, whenever I click on the CommandButton,
although I tried to avoid it by using the boolean variable by setting it to status = false ?
Is there another way how I can avoid the OnChange event of the combobox?
I already tried combobox.enabled = false and combobox.locked= true,
but this does not work either.
Have you any other suggestions how my problem can be solved?