title: Excel VBA DoWhile Loop - how to return list of items with each loop?
body: <p>I am pulling entries from a purchase order template in 1 worksheet into a database worksheet that will record all purchase order date in the same Excel workbook.  The SKU's ordered on the order template tab will often exceed 1, and will differ from one another.  Wondering how to pull the differing SKU No.'s into the database tab with an edit to VBA code below:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
      Dim OrderDate As String, PONumber As String, Vendor As String, ShipTo As String, SKU As String
      Worksheets("Order Form 1").Select
      OrderDate = Range("B3")
      PONumber = Range("D3")
      Vendor = Range("B7")
      ShipTo = Range("D7")
      SKU = Range("F3")
      R = 3
      Do While Cells(R, 6) &lt;&gt; ""
          Worksheets("Database").Select
          Worksheets("Database").Range("A1").Select
          If Worksheets("Database").Range("A1").Offset(1, 0) &lt;&gt; "" Then
              Worksheets("Database").Range("A1").End(xlDown).Select
          End If
          ActiveCell.Offset(1, 0).Select
          ActiveCell.Value = OrderDate
          ActiveCell.Offset(0, 1).Select
          ActiveCell.Value = PONumber
          ActiveCell.Offset(0, 1).Select
          ActiveCell.Value = Vendor
          ActiveCell.Offset(0, 1).Select
          ActiveCell.Value = ShipTo
          ActiveCell.Offset(0, 1).Select
          ActiveCell.Value = SKU
          Worksheets("Order Form 1").Select
          R = R + 1
      Loop
  End Sub
  </code></pre>