Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    suppress event change in combobox... (2000)

    in a macro have a statement area1.clear (area1 is combobox) and in the private sub event_change of area1 have other code....
    but when the code go on area1.clear start the code in area1_change...!!!!!!!! naturally i want to clear items in area1
    Possible to suppress this event

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: suppress event change in combobox... (2000)

    You can declare a module-level variable at the top of the userform module:

    Private SuppressEvent As Boolean

    and use it in your code as follows:

    Private Sub ComboBox1_Change()
    If SuppressEvent Then
    ' Get out if SuppressEvent is True
    Exit Sub
    End If
    ' Your code here
    ...
    End Sub

    Private Sub CommandButton1_Click()
    ' Set the variable to True
    SuppressEvent = True
    ' Clear the combo box
    Me.ComboBox1.Clear
    ' Set the variable to False
    SuppressEvent = False
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •