title: VBA code behaving differently when stepping
body: <p>I am trying to write code that will handle the "change" event of any ComboBox on my userform.</p>
  
  <p>I went by <a href="https://stackoverflow.com/questions/5940596/excel-vba-userform-execute-sub-when-something-changes">this</a> question's answer and created a separate class, etc.</p>
  
  <p>However, it doesn't work. Using the same code on a new project works fine, this code on this project works sometimes when I use the "step by step" execution (F8), but when using normal running it doesn't.</p>
  
  <p>Looking at other people's similar predicaments I added "DoEvents" but that didn't help.</p>
  
  <p>This is my code in the UserForm</p>
  
  <pre><code>Private Sub UserForm_Initialize()
  
  Dim ComboBox_Collection As Collection
  Dim ctrl As Control
  Dim cbc As ComboBox_Class
  
  Set ComboBox_Collection = New Collection
      For Each ctrl In UserForm1.MultiPage.Pages(2).Controls
      DoEvents
          If TypeName(ctrl) = "ComboBox" Then
              DoEvents
              Set cbc = New ComboBox_Class
              Set cbc.Control = ctrl
              ComboBox_Collection.Add cbc
              DoEvents
          End If
      Next ctrl
  Set cbc = Nothing
  
  End Sub
  </code></pre>
  
  <p>And the class module, named "ComboBox_Class":</p>
  
  <pre><code>Private WithEvents TriggerComboBox As MSForms.ComboBox
  
  Public Property Set Control(CB As MSForms.ComboBox)
      Set TriggerComboBox = CB
  End Property
  
  Private Sub TriggerComboBox_Change()
      MsgBox ("yay")
  End Sub
  </code></pre>