so i have a user form created with the following code
Private Sub userForm_Initialize()
Me.ComboBox1.List = Array("15mg", "30mg")
End Sub
Private Sub CommandButton1_Click()
Dim lrow As Long, offstcol As Long
lrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
If ComboBox1.Value = "30mg" Then offstcol = 2
With Sheets(1)
Range("A" & lrow).Value = VBA.Format(TextBox1.Value, "m/d/yyyy") 'set the value in the first empty row in column A to the date textbox
Range("B" & lrow).Offset(, offstcol).Value = TextBox2.Value 'set the value in the first empty row in column B to the Quantity A textbox
Range("C" & lrow).Offset(, offstcol).Value = TextBox3.Value 'set the value in the first empty row in column C to the Quantity B textbox
Range("F" & lrow).Value = TextBox4.Value
End With
Unload Me 'close the form
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
i want to add one more line to this code so that if my pulldown box has nothing selected then it wont add let you click the add button/enter
i think it should start out like this but i dont know how to finish the code off
If ComboBox1.Value = "" Then
thanks for any help
JED
Bookmarks