Hi there
I have created a user form with rows of data for the purposes of using as an order form.
At present there are only 3 rows but I eventually want to add further items.
I am trying to apply coding that will review each line of data on the userform to see if it contains values and if it does then to copy it to a worksheet. If the values are blanks then I want it to move to the next row of data and so on until it copies all rows that contain data.
However, the code I have only seems to copy the first row of data. Any help in resolving this would be great. Code below.
I have created a user form with rows of data for the purposes of using as an order form.
At present there are only 3 rows but I eventually want to add further items.
I am trying to apply coding that will review each line of data on the userform to see if it contains values and if it does then to copy it to a worksheet. If the values are blanks then I want it to move to the next row of data and so on until it copies all rows that contain data.
However, the code I have only seems to copy the first row of data. Any help in resolving this would be great. Code below.
Code:
Private Sub cmdconfirmorder_Click()
Worksheets("basket").Activate
txtDate.Text = Format(Now(), "MM/DD/YY")
Dim NextNum As Long
NextNum = Application.WorksheetFunction.Max(Sheet4.UsedRange.Columns(3))
Me.txtOrderNumber.Value = NextNum + 1
Me.txtOrderNumber.Enabled = False
Range("B1").Value = lstAcademy.Value
Range("D1").Value = txtDate.Value
Range("F1").Value = txtOrderNumber.Value
eRow = Worksheets("basket").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
If Me.sizegiwhite.Value <> "" Or Me.quantitygiwhite.Value <> "" Then
Cells(eRow, 1) = giwhite.Value
Cells(eRow, 2) = sizegiwhite.Value
Cells(eRow, 3) = quantitygiwhite.Value
GoTo Line1
Else
GoTo Line1
Line1:
If Me.sizegiblack.Value <> "" Or Me.quantitygiblack.Value <> "" Then
Cells(eRow, 1) = giblack.Value
Cells(eRow, 2) = sizegiblack.Value
Cells(eRow, 3) = quantitygiblack.Value
GoTo Line2
Else
GoTo Line2
Line2:
If Me.sizefct.Value <> "" Or Me.quantityfct.Value <> "" Then
Cells(eRow, 1) = fct.Value
Cells(eRow, 2) = sizefct.Value
Cells(eRow, 3) = quantityfct.Value
GoTo Line3
Else
GoTo Line3:
Line3:
Exit Sub
End If
End If
End If
End Sub