Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can this be done?? WarrenC Excel Discussion (Misc queries) 6 July 10th 06 10:19 PM
visualize perf counter data John A Grandy Charts and Charting in Excel 1 April 28th 06 06:45 PM
Semi Annual Counter ExcelMonkey Excel Worksheet Functions 1 April 21st 06 11:04 PM
Counter in a worksheet Jason B Excel Worksheet Functions 3 January 26th 06 07:00 PM
Creating a counter that does not include hidden rows TechMGR Excel Discussion (Misc queries) 1 April 4th 05 10:11 PM


All times are GMT +1. The time now is 08:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"