Thread: Invoice
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Johan Snyder Johan Snyder is offline
external usenet poster
 
Posts: 2
Default Invoice

Sorry this was the code used....

Sub TransmitAndClearInvoice()
' Makro by Iwer Morck
'
Sheets("Invoice").Select
If [C12].Value = "" Then Exit Sub
If [B20].Value = "" Then Exit Sub
If [K2].Value = "" Then Exit Sub

With Sheets("InvRecords")


x = .Cells(.Rows.Count, 1).End(xlUp).Row + 1

If .Columns(1).Find(What:=[K2], _
LookIn:=xlValues, _
LookAt:=xlWhole) Is Nothing Then

r = 20

Do
.Cells(x, 1).Value = [K2] ' Invoice Number
.Cells(x, 2).Value = Date ' Date
.Cells(x, 3).Value = [C12] ' Customer Number
.Cells(x, 4).Value = [C13] ' Name
.Cells(x, 5).Value = [C14] ' Address
.Cells(x, 6).Value = [C15] ' Code
.Cells(x, 7).Value = [C16] ' Phone
.Cells(x, 8).Value = [J16] ' Sales Consultant
.Cells(x, 9).Value = Cells(r, 2).Value ' Item Number
.Cells(x, 10).Value = Cells(r, 3).Value ' Description
.Cells(x, 11).Value = Cells(r, 8).Value ' Unit
.Cells(x, 12).Value = Cells(r, 9).Value ' Qty
.Cells(x, 13).Value = Cells(r, 10).Value ' Price
.Cells(x, 14).Value = Cells(r, 11).Value ' Total
x = x + 1
r = r + 1
Loop Until Cells(r, 2).Value = ""
Range("C12").Value = ""
Range("ITEM_NO").ClearContents
Range("QTY").ClearContents
Range("K2").Value = Range("K2").Value + 1
Range("C12").Select

Else
MsgBox "The invoice number already exists"
End If
End With

End Sub
"Johan Snyder" wrote in message
...
Dear Mr's and Mrs's

Years ago Tom Ogilvy and Ivor Merck assisteg me in the same problem. The
solution was to save the critical data on the invoice in an invoice record
sheet, then look for the last saved invoice number. This would be the one
you just saved, then add 1 to the number and enter it on the next invoice.

Johan Snyder
South Africa