Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counter in Excel template
Hi,
Before I ask I did spend quite some time searching google groups so I hope this is an interesting question for someone. I am creating an template within excel for purchase orders and the user will enter certain data which will be computed via formula no problem. MY ISSUE is..... I the template to hold some sort of counter value which will increment each and every time a child document is created from it. First time open counter or P.O. number is 1......second time is 2 etc etc. This is regardless of whether the child document is saved or anything. Upon spawning the child increment by one..... Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counter in Excel template
Hello office newbie, This counter will increment every time the template is opened. You ca also use these same calls elsewhere in the code to increment the counte if you need to. You can change the names template, opened, and counte to whatever you like. The counter is stored in the Registry of th machine it resides on. This insures the count will be accurate, even i the program crashes. Code ------------------- Private Sub Workbook_Open() Dim Cnt As Long Cnt = Val(GetSetting("template", "opened", "counter")) Cnt = Cnt + 1 SaveSetting "template", "opened", "counter", Str(Cnt) End Sub ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48751 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Counter in Excel template
FANTASTIC....
Thank you so much. Have a wonderful holidays. Leith Ross wrote: Hello office newbie, This counter will increment every time the template is opened. You can also use these same calls elsewhere in the code to increment the counter if you need to. You can change the names template, opened, and counter to whatever you like. The counter is stored in the Registry of the machine it resides on. This insures the count will be accurate, even if the program crashes. Code: -------------------- Private Sub Workbook_Open() Dim Cnt As Long Cnt = Val(GetSetting("template", "opened", "counter")) Cnt = Cnt + 1 SaveSetting "template", "opened", "counter", Str(Cnt) End Sub -------------------- Sincerely, Leith Ross |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
row counter tool for excel 2003 | Excel Discussion (Misc queries) | |||
OTHER EXCEL FUNCTION COUNTER SOLUTION ? | Excel Worksheet Functions | |||
How do I set up a counter in excel? | Setting up and Configuration of Excel | |||
Increment a counter in Excel | Excel Worksheet Functions | |||
purchase order counter in excel purchase order template | Excel Worksheet Functions |