ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do I make a counter cell in excel (https://www.excelbanter.com/excel-programming/355302-how-do-i-make-counter-cell-excel.html)

Ehab Hassan

how do I make a counter cell in excel
 
Can some one help me in telling me how can I do a counter in the excel which
will increase the number by 1 every time I press F9.

Chris Marlow

how do I make a counter cell in excel
 
Hi,

There may be a neater way to do this, but worth trying;

In the sheets code module add;

Private lMyCounter As Long

Public Property Get MyCounter() As Long

MyCounter = lMyCounter

End Property

Public Property Let MyCounter(lNewValue As Long)

lMyCounter = lNewValue

End Property

In a 'normal' module add;

Public Function ShowMyCounter(dTrigger As Date) As Long

Sheet1.MyCounter = Sheet1.MyCounter + 1

xMyCounter = Sheet1.MyCounter

End Function

In the sheet you can now reference the formula;

=ShowMyCounter(NOW())

The 'trigger' is required to make the thing recalc when you hit f9.

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"Ehab Hassan" wrote:

Can some one help me in telling me how can I do a counter in the excel which
will increase the number by 1 every time I press F9.


Niek Otten

how do I make a counter cell in excel
 
http://www.mcgimpsey.com/excel/accumulator.html

--
Kind regards,

Niek Otten

"Ehab Hassan" <Ehab wrote in message
...
Can some one help me in telling me how can I do a counter in the excel
which
will increase the number by 1 every time I press F9.





All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com