Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do I set up a counter?
I want to set up a cell which counts how many times a macro button has
been clicked. It also nees to be re-setable - presumably using another macro. Any suggestions Cheers John Taylor "John Taylor's Freebies" www.johnandgwyn.co.uk (a free, teachers' resource website) If replying by email take out "therubbish" |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do I set up a counter?
Use code like the following:
Sub IncrementCounter() With ThisWorkbook.Worksheets("Sheet1").Range("A1") '<<< CHANGE .Value = .Value + 1 End With End Sub Sub ResetCounter() ThisWorkbook.Worksheets("Sheet1").Range("A1").Valu e = 0 End Sub Assign IncrementCounter to your macro button, or call the function from the code already attached to the button. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "John T" wrote in message ... I want to set up a cell which counts how many times a macro button has been clicked. It also nees to be re-setable - presumably using another macro. Any suggestions Cheers John Taylor "John Taylor's Freebies" www.johnandgwyn.co.uk (a free, teachers' resource website) If replying by email take out "therubbish" |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do I set up a counter?
Thanks for your help - it looks as though I'm going to have to do some studying - never come across "Sub" or "code" before - presumably it's a bit like defining procedures in old-fashioned BASIC. I've just tried to find "sub" and "code in Steve Johnson's "Brilliant Excel 2003" (published by Pearson Books) - not there! Cheers John T t On Thu, 19 Oct 2006 13:34:51 -0500, "Chip Pearson" wrote: Use code like the following: Sub IncrementCounter() With ThisWorkbook.Worksheets("Sheet1").Range("A1") '<<< CHANGE .Value = .Value + 1 End With End Sub Sub ResetCounter() ThisWorkbook.Worksheets("Sheet1").Range("A1").Valu e = 0 End Sub Assign IncrementCounter to your macro button, or call the function from the code already attached to the button. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "John T" wrote in message ... I want to set up a cell which counts how many times a macro button has been clicked. It also nees to be re-setable - presumably using another macro. Any suggestions Cheers John Taylor "John Taylor's Freebies" www.johnandgwyn.co.uk (a free, teachers' resource website) If replying by email take out "therubbish" |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
how do I set up a counter?
Wow I've just learnt hoe to use code! (sort of) I've pasted your text in and adapted it and it works - MANY THANKS Is it possible to make a count down timer - i.e. counting seconds down to zero? Cheers John T On Thu, 19 Oct 2006 13:34:51 -0500, "Chip Pearson" wrote: Use code like the following: Sub IncrementCounter() With ThisWorkbook.Worksheets("Sheet1").Range("A1") '<<< CHANGE .Value = .Value + 1 End With End Sub Sub ResetCounter() ThisWorkbook.Worksheets("Sheet1").Range("A1").Valu e = 0 End Sub Assign IncrementCounter to your macro button, or call the function from the code already attached to the button. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "John T" wrote in message ... I want to set up a cell which counts how many times a macro button has been clicked. It also nees to be re-setable - presumably using another macro. Any suggestions Cheers John Taylor "John Taylor's Freebies" www.johnandgwyn.co.uk (a free, teachers' resource website) If replying by email take out "therubbish" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can this be done?? | Excel Discussion (Misc queries) | |||
visualize perf counter data | Charts and Charting in Excel | |||
Semi Annual Counter | Excel Worksheet Functions | |||
Counter in a worksheet | Excel Worksheet Functions | |||
Creating a counter that does not include hidden rows | Excel Discussion (Misc queries) |