Auto Update Number on opening or closing

C0^sTy

New Member
Joined
Oct 26, 2006
Messages
3
Hi Guys,

I was hoping you might be able to help me with this. I have got a purchase order form on Excel. Is it possible to have the actual purchase order number update itself upon opening or maybe even closing? Like it starts at say 1001, then the next time I open it it will have changed to 1002, then the next time 1003 etc etc ...

Reason for wanting to do this is so everytime the form is filled out and printed it would have a different purchase order number. Do you guys know if this possible?

Thanks! :biggrin:
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi
try
Code:
Private Sub Workbook_Open()

With Sheets("Sheet1").Range("a1") ' <- change to suite
   .Value = WorksheetFunction.Max(1001, .Value + 1)
End With

End Sub
 
Upvote 0
Hey jindon!

That seems to work when I run the macro but can I get it to run on its own like when I open the Excel sheet or maybe just when it closes? Like it opens on 1001 and I fill in the details then print, then the next time it opens it would be on 1002?
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,981
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top