Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
row counter tool for excel 2003 Ferds Excel Discussion (Misc queries) 0 March 11th 08 11:44 AM
OTHER EXCEL FUNCTION COUNTER SOLUTION ? romelsb Excel Worksheet Functions 6 October 27th 06 02:21 PM
How do I set up a counter in excel? Solanajack Setting up and Configuration of Excel 1 July 27th 05 11:51 PM
Increment a counter in Excel COSdl Excel Worksheet Functions 2 March 4th 05 10:47 PM
purchase order counter in excel purchase order template Brandy@baoco Excel Worksheet Functions 0 February 23rd 05 07:17 PM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"