View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ross ross is offline
external usenet poster
 
Posts: 81
Default Auto invoice numbering

Not very elegant, but easy to set up:

* what you need!
1 excel WB called "Invoice.xls" in which there are 2 sheets, "Invoice"
and "Data"

Concept:
You store a number in the data page which is updated when somthing
happens:

code bit one:
sheets("data").cells(1,1).value = sheets("data").cells(1,1).value +1

code bit 2
sheets("Invoice").Range("a2").value = sheets("data").cells(1,1).value

so this puts the number in a2 on the invoice sheet, which you format
as you like;

now where do you put these code?

well you can put code 2 in the open workbook event, and the code one
bit in the
before close, and you get a book that opens with a new invoice number
and updates it on each open/close,
Better, to put the 2 codes buttons on the Invocie sheet, and then you
can make as many invoice as you like, with out opening closing

so you get this

Private Sub CommandButton1_Click()
Sheets("data").Cells(1, 1).Value = Sheets("data").Cells(1, 1).Value +
1
Sheets("Invoice").Range("a2").Value = Sheets("data").Cells(1, 1).Value
End Sub

ross





"unkown" wrote in message news:<niscc.35943$Ig.27302@pd7tw2no...
I need a auto invoice numbering on a new worksheet that can add a
consequence invoice number from the previous worksheet number.

Any help is greatly appreciated.