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
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.
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.