Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit number of items to add to an invoice? 2

Status
Not open for further replies.

Pudsters

Technical User
Mar 16, 2006
151
US
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
 
Pudsters - please note the :
Thank rmikesmith
for this valuable post!


link at the bottom of all postings. This can be used to award 'stars' to people as thanks - it is also the way that 'useful' threads are marked out to others so that if people do a search on keywords, they can quickly identify those threads that have useful information in them

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Geoff, I never even noticed that. Thanks to you as well!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top