Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Count # of Times Sub Executes

Is there a way to keep track as to the number of times a
button is clicked. I have a command button on one of my
sheets and would like to keep track as to the number of
times a person runs the program. I would like to reset the
value when Excel closes.

Thanks,
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Count # of Times Sub Executes

I suggest, you use a Hidden sheet, so you can do the
following things on that sheet,
1.- On excel:
Tools/Macro/VisualBasic Editor/
on VisualBasicEditor:
View/Project Explorer/
View/Properties Window
--select the sheet you want to hide
(name it "MyCounter")---
on properties, select the Visible property
and set it to "2 - xlSheetVeryHidden"
File/Close and return toi Microsoft Excel)

2.- On the auto_open macro, you can set the value to zero,
( say A1), on the execution of you macro you can set the
value of that particular cell to the previous value plus
one, with:

With Thisworkbook.sheets("MyCounter").Range("A1")
.Value=.Value + 1
End With

You can see the value using:
Thisworkbook.sheets("MyCounter").Range("A1").Value

Francisco Mariscal



-----Original Message-----
Is there a way to keep track as to the number of times a
button is clicked. I have a command button on one of my
sheets and would like to keep track as to the number of
times a person runs the program. I would like to reset

the
value when Excel closes.

Thanks,
Mike
.

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
Count how many times a phrase comes up? Deplywrker Excel Worksheet Functions 3 November 13th 08 12:52 AM
count text appear how many times & put in respec col??eg 1st times Piglet Excel Discussion (Misc queries) 3 May 29th 08 07:53 AM
Count Number of Times Q Sean Excel Worksheet Functions 5 December 21st 06 05:00 PM
Count # of times a value is in another spreadsheet klafert Excel Discussion (Misc queries) 1 October 29th 06 02:22 PM
Count # of times a Reference is used klafert Excel Discussion (Misc queries) 5 August 7th 06 12:13 PM


All times are GMT +1. The time now is 07:13 AM.

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"