This follows in the footsteps of my previous posting from 10 minutes ago, and is part of the same UserForm code:
Below is the example of what I've written (I'm only showing 2 out of the 20 Loops). This works fine, except that when I click cmdOK, all twenty items (rows) are added to the database. I only want to add the rows for which the user has added a value into the TextBox. For instance. the user may only enter a value in TextBox1 and TextBox8. Those are the only lines (row) I want to see added to the database.
Thanks for any help you may be able to provide!
Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("TESTTYPE").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = cboName1.Value
ActiveCell.Offset(0, 1) = ComboBox.Value
ActiveCell.Offset(0, 2).Value = Label1
ActiveCell.Offset(0, 3).Value = txtStartDate.Value
ActiveCell.Offset(0, 4).Value = TextBox1.Value
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = cboName1.Value
ActiveCell.Offset(0, 1) = ComboBox.Value
ActiveCell.Offset(0, 2).Value = Label12
ActiveCell.Offset(0, 3).Value = txtStartDate.Value
ActiveCell.Offset(0, 4).Value = TextBox2.Value
End Sub
Bookmarks