Userform copy rows of data into worksheet but ignore blank rows

iankelly

New Member
Joined
Apr 2, 2014
Messages
1
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.

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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top