Sequencing Numbers

R

raquel

I'm trying to get an Excel purchase order template to
automatically number the PO's each time it's used.
 
J

Jason Morin

You can generate the next sequential PO# when the
workbook opens using VBA. Press ALT+F11, double-
click "ThisWorkbook" module, and paste in the following:

Sub Workbook_Open()
Set ponum = Sheets("Sheet1").Range("A1")
ponum.Value = .Value + 1
ActiveWorkbook.Save
End Sub

HTH
Jason
Atlanta, GA
 
H

Harlan Grove

Jason Morin said:
You can generate the next sequential PO# when the
workbook opens using VBA. Press ALT+F11, double-
click "ThisWorkbook" module, and paste in the following:

Sub Workbook_Open()
Set ponum = Sheets("Sheet1").Range("A1")
ponum.Value = .Value + 1
ActiveWorkbook.Save
End Sub
....

And every time you'd open the file it'd increment that number, so you'd have
to disable macros in order to open archived purchase orders. Also could
leads to problems when the PO file is closed without subsequent saving, in
which case there could be gaps in PO numbers.

Better to use BeforePrint to require the user to save the PO file before
printing, and use BeforeSave to fetch the next available PO number from a
central source.

Details may be found in hundreds of archived threads.

http://groups.google.com/groups?as_epq=sequential number&as_ugroup=*excel*
 

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