I have a button that adds items to an invoice (code below). But I only want to be able to add 10 items or 10 rows. So if the user attempts to add an 11th item, a message will popup saying, "Sorry, Invoice is Full. Must start another invoice to add more items."
Anybody know the proper code?
Private Sub cmdAdd_Click()
ActiveWorkbook.Sheets("Invoice").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = cboDescriptions.Value
ActiveCell.Offset(0, 2) = txtSilverstar.Value
ActiveCell.Offset(0, 3) = txtRegular.Value
ActiveCell.Offset(0, 4) = txtAfterhours.Value
Range("A1").Select
End Sub
Anybody know the proper code?
Private Sub cmdAdd_Click()
ActiveWorkbook.Sheets("Invoice").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = cboDescriptions.Value
ActiveCell.Offset(0, 2) = txtSilverstar.Value
ActiveCell.Offset(0, 3) = txtRegular.Value
ActiveCell.Offset(0, 4) = txtAfterhours.Value
Range("A1").Select
End Sub