title: Excel 2003 ListBox Type Mismatch when calling a sub
body: <p>Here's a Sub at the Workbook level:</p>
  
  <pre><code>Public Sub BuildList(targetSheet As Worksheet, ByRef targetListBox As ListBox, lastRow As Integer)
  
      For r = 1 To lastRow
  
          If Trim(targetSheet.Range("A" &amp; r).Value) &lt;&gt; "" Then
  
              With targetListBox
  
                  .AddItem Trim(targetSheet.Range("A" &amp; r).Value)
                  .List(.ListCount - 1, 1) = Trim(targetSheet.Range("B" &amp; r))
  
              End With
  
          End If
  
      Next r
  
  
  End Sub
  </code></pre>
  
  <p>Here's some code in a Userform that calls it:</p>
  
  <pre><code>Private Sub UserForm_Initialize()
  
      Dim ws As Worksheet
      Dim bottomRow As Integer
  
      Set ws = Worksheets("Our Status Code")
      bottomRow = ws.Range("A65536").End(xlUp).Row
  
      ThisWorkbook.BuildList ws, StatusCodesListbox, bottomRow
  
  
  End Sub
  </code></pre>
  
  <p>When it hits the line that calls BuildList it throws an error 13 and I can't see why.</p>