Sequencing Numbers

  • Thread starter Thread starter raquel
  • Start date Start date
R

raquel

I'm trying to get an Excel purchase order template to
automatically number the PO's each time it's used.
 
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
 
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*
 
Back
Top