title: Excel VBA - UserForm Combobox with If Statement
body: <p>I've created an Userform. The code is not completed yet, but trying to have conditions on the combobox. Here is the code:</p>
  <pre><code>Private Sub UserForm_Initialize()
  
      With SupText
          .AddItem &quot;Sup1&quot;
          .AddItem &quot;Sup2&quot;
          .AddItem &quot;Sup3&quot;
      End With
      
      With ProdText
          .AddItem &quot;Prod1&quot;
          .AddItem &quot;Prod2&quot;
          .AddItem &quot;Prod3&quot;
          .AddItem &quot;Prod4&quot;
          .AddItem &quot;Prod5&quot;
      End With
      
      With UnitText
          .AddItem &quot;kL&quot;
          .AddItem &quot;T&quot;
      End With
      
      With StaText
          .AddItem &quot;In Progress&quot;
          .AddItem &quot;Awaiting&quot;
          .AddItem &quot;&quot;
      End With
      
      With ProLText
          .AddItem &quot;1&quot;
          .AddItem &quot;4&quot;
          .AddItem &quot;1&amp;4&quot;
          .AddItem &quot;2&quot;
          .AddItem &quot;3&quot;
          .AddItem &quot;2&amp;3&quot;
          .AddItem &quot;WOPL&quot;
          .AddItem &quot;BOPL&quot;
          .AddItem &quot;Industry Line&quot;
      End With
      
      End Sub
  </code></pre>
  <p>So, what I'm trying to do is to <code>ProLText</code> combobox to populate the list according to the <code>SupText</code>. When I use an <code>if</code> statement it doesn't work. For instance, if the choose the Sup1 from SupText Combobox I would like to give only the first 6 option of the ProLText combobox, the Sup2 gives the next 2 and Sup3 the last item. But for some reason, it gives result on for the else statement and not for if or else if.</p>
  <p>Any ideas why it doesn't work?</p>
  <p>Regards.</p>