How can I make cell value update automatically upon opening each time

nickrussw

New Member
Joined
Oct 21, 2014
Messages
2
In Microsoft excel, I'd like to enter an order number in one of the cells for each packing slip of each order.
What I'm wondering is, how would I make it so that value would automatically update everytime I open my excel template.

eg. after I finish a packing slip and the order# is 1001 I save and close then the next time I open the template the cell automatically updates to order#1002


Can this be done?


Any help I much appreciated

Thanks
Nick
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
In Microsoft excel, I'd like to enter an order number in one of the cells for each packing slip of each order.
What I'm wondering is, how would I make it so that value would automatically update everytime I open my excel template.

eg. after I finish a packing slip and the order# is 1001 I save and close then the next time I open the template the cell automatically updates to order#1002
You can use event code to do that. Press ALT+F11 to bring up the VB editor... once up, look to its left side for a sub-window named "Project-VBAProject" and double click the item in its list named "ThisWorkbook" and then copy/paste this code into the code window that opens up (change the name of the sheet and the cell address to correspond to the cell where your order number is actually located)...
Code:
Private Sub Workbook_Open()
  Sheets("[COLOR=#FF0000][B]Sheet1[/B][/COLOR]").Range("[COLOR=#0000FF][B]A1[/B][/COLOR]").Value = Sheets("[COLOR=#FF0000][B]Sheet1[/B][/COLOR]").Range("[COLOR=#0000FF][B]A1[/B][/COLOR]").Value + 1
End Sub
Note... if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,779
Messages
6,126,846
Members
449,343
Latest member
DEWS2031

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