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
SQL SERVER 2008 service not starting
WSUS 3.0 server motherboard
excel macro find selected range to use within macro
Design a Query to subtract a record value from previous record value
Form update in Access 2007
Simple (I think) but Urgent: Copy (XCopy?) files from multiple subdirectories into one directory
Reading dBase files with attached MDX via ADO.NET
Cannot Install SP4 on Windows 2000 Server
GridView-FormView Master-Detail Setup (Programmatic Solution)
reverse string using SQL function