ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Use Counter (https://www.excelbanter.com/excel-programming/336540-macro-use-counter.html)

scantor145[_20_]

Macro Use Counter
 

I'm sure everyone has gone to a website that shows the number of users
who've visited the site. Is it poosible to put such a counter into a
macro so that the next time the initial form opens it displays the
number of times it's been opened?


--
scantor145
------------------------------------------------------------------------
scantor145's Profile: http://www.excelforum.com/member.php...o&userid=14766
View this thread: http://www.excelforum.com/showthread...hreadid=393408


Tom Ogilvy

Macro Use Counter
 
Obviously, to be of any use and the value/count is to be stored in the
workbook, the workbook would have to be saved each time the form is shown.
Is that acceptable? An alternative is to use the registry or a separate
file. The registry is only useful if it is to be used on a single computer.
A separate file would have to be located with the workbook. By the way,
what do you mean by FORM? Do you mean a userform or are you setting up a
worksheet to look like a paper form/webpage?

--
Regards,
Tom Ogilvy
"scantor145" wrote
in message ...

I'm sure everyone has gone to a website that shows the number of users
who've visited the site. Is it poosible to put such a counter into a
macro so that the next time the initial form opens it displays the
number of times it's been opened?


--
scantor145
------------------------------------------------------------------------
scantor145's Profile:

http://www.excelforum.com/member.php...o&userid=14766
View this thread: http://www.excelforum.com/showthread...hreadid=393408




Edward Ulle

Macro Use Counter
 
On some obscure worksheet place a named cell "Counter". On your initial
form place a text box and set its "ControlSource" to Counter. Everytime
the macro executes increment Counter

' Code to show Userform

Option Explicit

Sub Test()
UserForm1.Show
End Sub

' Code to increment counter code of Userform

Option Explicit

Private Sub UserForm_Activate()
Range("Counter") = Range("Counter") + 1
End Sub


*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 01:26 PM.

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