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
Drop down list to display two columns but only bring 1 value in
Exchange 2007 SP2 permission issues
New DC Server 2008 Lots of Traffic
displaying fields total amount in textbox on form
grabbing text from a string after a logic
Problem with "shutdown" DOS command
Data Loss & Recovery - FAT 16 - NTFS 160GB USB drive. Possible bad MBR or Partition Table
VB.NET Lambda/LINQ batch function
MS SQL Output producing duplicate data
How can I retrieve OS and Hardware Device Information using Compact Framework in VB only?