Microsoft
Software
Hardware
Network
Question : Public Counter in VBA
How can I declare a public variable and assign it a value of 1 and then increment that count inside procedures that will be called many times. The counter should hold the last value it has until the excel file is closed. As an example:
When the file opens icnt=1 and then inside one or more procedures that are called... icnt = icnt +1 will continue to increase icnt until the file closes.
Thanks,
Jerry
Answer : Public Counter in VBA
In any general code module's declaration section (before any procedures):
Public icnt As long
In the workbook open event handler:
icnt = 1
In your routines:
icnt = icnt + 1
Kevin
Random Solutions
Cannot use Microsoft Word to edit messages in Outlook 2003
Owa acces fails
Need an XSD viewer
OCS 2007 Issue
Error when updating from MS Money 2000 to MS Money 2008
T-SQL: calculate totals in SELECT statement witout GROUP BY
ranking records and determining percentage of total in access 2007
How do I control (set) printer properties programatically without the print dialog window?
Is there any free fast low level formatting tool.
How do I change Notepad to print landscape using Access VBA