Counter

Skyhook

New Member
Joined
Apr 8, 2002
Messages
38
I have been trying to place a code in my userfrom so that when it used an set amount of times it will not work. So I guess my question is, can a counter be placed in a user form so that when a form is used X amount of times the form / application will not work.

Thanks
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I think you would need to use a counter and write the result to disk. Then check against the written result when the macro runs.
 
Upvote 0
Hi

Try this

Set a cell say A1 my old fav cell and enter value 0

now code out so counter = range A1 and then range a1 = counter + 1 so it changes each time opened, add this to some routeen you write and place in Auto_Open()

so will update each time shhet opened.

By the way can be date ie if > 10/04/02 then exit or what ever you like.

other ideas.. your need to say if A1 = or reater than X the exit as error handle thou:

That kind of idea, and link the user form to this data and script...


does this help?
Just some ideas..
 
Upvote 0
Thanks for the help Jack but the application will still open. What I would like for it to do is to not open at all once the workbook has been opened 5 times. The following is the code I have so far.
Thanks in advance

Private Sub Workbook_Open()
UserForm1.Show
Dim CounterSum As Integer

CounterSum = Sheet1.Range("IV65536").Value
Sheet1.Range("IV65536").Value = CounterSum + 1
If CounterSum >= 5 Then ThisWorkbook.Close
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,495
Messages
6,113,992
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top