HOW DO INSERT AN AUTONUMBER INTO AN INVOICE TEMPLATE IN EXCEL

G

Guest

I have a template of an invoice (in excel) but I need it to automatically
generate a different invoice number every time I open it. Such as 001 the
1st time, 002 the 2nd time etc.

I have no knowledge of macros & do not want to uses Acess.
 
P

Paul B

JW69,

A simple way would be to use something like this, you could assign it to a
button, an open or before print event.
Sheets("Sheet1").Range("A1").Value = _
Sheets("Sheet1").Range("A1").Value + 1

BUT, if you did save it as a temple, as you said, that want work, have a
look here for ways to do it
http://www.mcgimpsey.com/excel/udfs/sequentialnums.html


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
P

Paul B

JW69,

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is at the top-left of the spreadsheet this will
open
the VBA editor, in Project Explorer click on your workbook name, if you
don't see it press CTRL + r to open the Project Explorer, then go to insert,
module, and paste the code in the window that opens on the right hand side,
press Alt and Q to close this window and go back to your workbook. To put
the button on your sheet, view, toolbars, forms, click on the button then
click on your sheet where you want the button, a box will come up to assign
a macro, pick this macro from the list, OK change the name on the
button if you want to, right click on it to do this. If you are using excel
2000 or newer you may have to
change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium


To change the number when you open the workbook

To put in this macro, from your workbook right-click the workbook's icon and
pick View Code. This icon is at the top-left of the spreadsheet this will
open the VBA editor, in Project Explorer double click on thisworkbook, under
your workbook name, if you don't see it press CTRL + r to open the Project
Explorer, then, paste the code in the window that opens on the right hand
side, press Alt and Q to close this window and go back to your workbook, now
this will run every time you open the workbook. If you are using excel 2000
or newer you may have to change the macro security settings to get the macro
to run. To change the security settings go to tools, macro, security,
security level and set it to medium

And if you are new to macros you may also what to have a look here on
getting started with macros
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
G

Guest

After opening window in VBA editor by entering insert, module,
where do I get the code to insert?
(computer for dummies 101- laugh)
 
P

Paul B

JW69, copy the code I gave and paste

Sheets("Sheet1").Range("A1").Value = _
Sheets("Sheet1").Range("A1").Value + 1


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
P

Paul B

of course you would need to put it in a sub like this, copy and paste

Sub Invoice_Number()
Sheets("Sheet1").Range("A1").Value = _
Sheets("Sheet1").Range("A1").Value + 1
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 
G

Guest

When I go to view, toolbars, forms the toolbar opens but the 'toggle grid'
button are disabled.

When pasting the code, what shouldn't the sheet, workbook & cell address be
changed to mine? If so exactly wher in the code?
Sorry for all the trouble. Can I just email the workbook to you?
 
P

Paul B

send the workbook to (e-mail address removed) remove 1 from address that is an
underscore between paul and b

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003
 

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