Private Sub CommandButton1_Click()
Dim i As Integer
Dim ws As Worksheet
Sheet4.Activate
'Set Ws = Sheets("Sheet4")
If Not IsEmpty(Sheets("Scan Here").Range("A640")) Then
MsgBox "You have reached the end of the form."
Exit Sub
End If
If IsEmpty(Description) Or Description = "" Then
MsgBox "No such product found. Please enter a valid UPC or Item #."
Exit Sub
End If
'position cursor in the correct cell A2.
Range("A2").Select
i = 1 'set as the first ID
'check to see the next available blank row start at cell A2...
Do Until ActiveCell.Value = Empty
ActiveCell.Offset(1, 0).Select 'move down 1 row
i = i + 1 'keep a count of the ID for later use
'Copy Item Number in N Rows
For Each Cell In Range(Cells(2, "C"), Cells(Cells(Rows.Count, "C").End(xlUp).Row, "C"))
cpyRng = Cells(Rows.Count, "C").End(xlUp).Row + 1
Cells(cpyRng, "C").Resize(1, 2) = Cell.Value
Next Cell
Loop
'Populate the new data values into the 'Scan Here' worksheet.
ActiveCell.Value = i 'Next ID number
ActiveCell.Offset(0, 1).Value = Me.UPCNum.Value 'set col B
ActiveCell.Offset(0, 2).Value = Me.ItemNum.Value 'set col C
ActiveCell.Offset(0, 16).Value = Me.LabelQTY.Value 'set col Q
'Clear down the values ready for the next record entry...
Me.UPCNum.Value = Empty
Me.ItemNum.Value = Empty
Me.Description.Text = Empty
Me.Quantity.Value = Empty
Me.Price.Value = Empty
Me.LabelQTY.Value = Empty
Me.ItemNum.SetFocus 'positions the cursor for next record entry
LabelCnt.Value = Range("A" & Rows.Count).End(xlUp).Value
LastItem.Value = Range("C" & Rows.Count).End(xlUp).Value
End Sub