Increment an Invoice number

G

Guest

I have an Invoice template, which is used with SaveAs to create a new invoice. Can the invoice numbers be automatically incremented?
 
F

Frank Kabel

Hi
only if you're willing to use VBA. e.g. use the workbook_Beforesave
event. A repost (using a template and the workbook_open event):

----------------
one way (using the Windows registry for storing the last number). Put
the following code in the workbook module (not in a standard module) of
your template:
- It changes cell A1 of the first sheet
- you may change the key identifiert according to your needs (e.g.
DEFAULTSTART, MYLOCATION, etc.)

Private Sub Workbook_Open()
Const DEFAULTSTART As Integer = 1
Const MYAPPLICATION As String = "Excel"
Const MYSECTION As String = "myInvoice"
Const MYKEY As String = "myInvoiceKey"
Const MYLOCATION As String = "A1"
Dim regValue As Long

With ThisWorkbook.Sheets(1).Range(MYLOCATION)
If .Text <> "" Then Exit Sub
regValue = GetSetting(MYAPPLICATION, MYSECTION, _
MYKEY, DEFAULTSTART)
.Value = CStr(regValue)
SaveSetting MYAPPLICATION, MYSECTION, MYKEY, regValue + 1
End With
End Sub
 
G

Guest

Depending on the complexity of use required, you can save
last invoice number to a cell (or add it to a list of
numbers), then simply add the increment to that number for
the new invoice.

-----Original Message-----
I have an Invoice template, which is used with SaveAs to
create a new invoice. Can the invoice numbers be
automatically incremented?
 
G

Guest

I find all this very confusing - I am not that computer literate. How do I
save the last invoice number to a cell - will it automatically change with
each new invoice or will I have to type it in each time?

Depending on the complexity of use required, you can save
last invoice number to a cell (or add it to a list of
numbers), then simply add the increment to that number for
the new invoice.

-----Original Message-----
I have an Invoice template, which is used with SaveAs to
create a new invoice. Can the invoice numbers be
automatically incremented?
 
J

JulieD

Hi

if you'ld like to email me (julied_ng at hcts dot net dot au) direct i can
send you a sample workbook, that you might be able to adapt to your needs ..

Cheers
JulieD

Gwyneth said:
I find all this very confusing - I am not that computer literate. How do I
save the last invoice number to a cell - will it automatically change with
each new invoice or will I have to type it in each time?

Depending on the complexity of use required, you can save
last invoice number to a cell (or add it to a list of
numbers), then simply add the increment to that number for
the new invoice.

-----Original Message-----
I have an Invoice template, which is used with SaveAs to
create a new invoice. Can the invoice numbers be
automatically incremented?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top