title: Excel VBA Listbox displays more times than expected
body: <p>My macro goes through all data rows on a specific sheet.  Currently there are 6 rows.  The first row is a negative number and the 2nd row is a positive number (debit and credit).</p>
  <p>The macro reviews each row and displays a list box for the user to make a selection.  Then it goes through the next row and does the same thing.  I'm expecting the listbox to display 6 times, once for each row of data.</p>
  <p>The problem I'm having is that the listbox is displaying 7 times.  3 times for the first pair or records and twice for the remaining pair of records.  I can't figure out why the listbox is displaying the extra time.</p>
  <p>Here is the code for the list box:</p>
  <pre><code>Private Sub ContinueButton_Click()
      If IsNull(ListBox1.Value) Then
          MsgBox &quot; Please select the appropriate balance to continue. &quot;
          Exit Sub
      Else
          MyIndex = 0
          MyIndex = ListBox1.ListIndex
          MyIndex = MyIndex + 1
          
          MyBal = &quot;&quot;
          MyBal = APIARArray(MyIndex, 4)
      
         Unload UserForm1
         UserForm1.Hide
      
         Sleep 750
      End If
  End Sub
  
  Private Sub UserForm_Initialize()
      UserForm1.Label1.Caption = &quot;Please select the appropriate balance for Unit: &quot; &amp; vUnit
  
      ListBox1.ColumnCount = 4
      ListBox1.ColumnWidths = &quot;50;50;75;50&quot;
      
      Dim i As Integer
      
      With ListBox1
          w = 1
          i = 0
          
          For w = 1 To UBound(APIARArray)
              DoEvents
                  .AddItem
                  .List(i, 0) = APIARArray(w, 1)
                  .List(i, 1) = APIARArray(w, 2)
                  .List(i, 2) = APIARArray(w, 3)
                  .List(i, 3) = format(APIARArray(w, 4), &quot;#,##0.00;[Red](#,##0.00)&quot;)
                          
              i = i + 1
          Next
      End With
      
      UserForm1.Height = 215
      UserForm1.Width = 348
      
      ListBox1.SetFocus
      
  End Sub
  </code></pre>
  <p>This is the code that calls the ListBox:</p>
  <pre><code>Sub LookForBalance()
  
      Dim r As Integer
      Dim APIUnit As String
      r = 2
      
      Do Until Len(Trim(Cells(r, 1))) + Len(Trim(Cells(r, 7))) + Len(Trim(Cells(r, 9))) + Len(Trim(Cells(r, 10))) + Len(Trim(Cells(r, 11))) = 0
          
          DoEvents
                      
          If Trim(Cells(r, 27)) = &quot;A199&quot; Then
              If Cells(r, 29) &gt; 90 Then
                  APIUnit = &quot;&quot;
                  vUnit = &quot;&quot;
                  vUnit = Trim(Cells(r, 11))
                      
                  If MyCntry = &quot;A1&quot; Then APIUnit = clsAPI.APIARSearch(&quot;WWW11&quot;, Trim(Cells(r, 11)))         
                  If MyCntry = &quot;A2&quot; Then APIUnit = clsAPI.APIARSearch(&quot;WWW12&quot;, Trim(Cells(r, 11)))         
                      
                  If InStr(1, APIUnit, &quot;ERROR&quot;) &gt; 0 Then
                      Cells(r, 30) = &quot;Unit Not Found&quot;
                  Else
                      If UBound(APIARArray) &gt; 1 Then
                          Load UserForm1
                          UserForm1.Show
                      
                          Cells(r, 30) = MyBal                                                                            
                      Else
                          Cells(r, 30) = APIARArray(1, 4)                                                                                 
                      End If
                  End If
              End If
          End If
          r = r + 1
      Loop
  End Sub
  </code></pre>
  <p>There isn't much code here but I'm not sure what is going on.  Any help or suggestions to resolve this issue would be greatly appreciated.  Thanks in advance for your help.....</p>