title: VBA UserForm: Copy and Paste based on Criteria
body: <p>I am creating a UserForm in VBA that will look up a specific box size from a separate sheet that contains over 3000 unique box sizes and returns into another sheet only the corresponding columns for that size.</p>
  
  <p>I have tried many types of loops with for each and for which simply didn't work. So I tried to create a copy and paste method that will copy all the rows where the first column matches the value from my Combobox. The issue that I continue to run into is with my line of code with my destination/paste range. I get run-time error 1004 "You can't paste here because the Copy area and paste area aren't the same size".</p>
  
  <p>This is the VBA code I currently have in my UserForm once the Enter Button is clicked. For reference, the sheet that contains all the data that I want to search for is Lookup Draft and the sheet where I want to paste the matching rows is Box Lookup Data.</p>
  
  <pre><code>Sub EnterButton_Click()
  
  Dim ws As Worksheet
  Dim datawks As Worksheet
  
  Set ws = Worksheets("Box Lookup Data")
  Set datawks = Worksheets("Lookup Draft")
  
  Dim LastRow As Long
  Dim i As Long, j As Long
  
     'Find the last used row
     With datawks
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
     End With
  
     'first row number to paste values
     With ws
        j = .Cells(.Rows.Count, "B").End(xlUp).Row + 1
     End With
  
     'copy from datawks to ws
     For i = 1 To LastRow
         With datawks
             If .Cells(i, 1).Value = ComboBox.Text Then
                 .Rows(i).Copy Destination:=ws.Range("B" &amp; j)
                 j = j + 1
             End If
         End With
     Next i
  
  End Sub
  </code></pre>
  
  <p>I have tried to change the line of code containing destination to a cell reference but that also does not work. I want the pasted range to include all the matching rows, not just the first match found- which is the issue I was running into before trying out copy/paste.</p>
  
  <p>The sheet where I want to paste has 5 labeled columns: (B)Box Size, (C)Customer, (D)Price, (E)Quantity, and (F)Order Date</p>
  
  <p>Any thoughts?</p>