![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Location: East Texas
Posts: 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 |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
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.
__________________
It's never too late to learn something new. Ricky |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 3,065
|
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..
__________________
Free Excel based Web Toolbar available here. Jack in the UK J & R Excel Solutions "making Excel work for you" |
|
|
|
|
|
#4 |
|
New Member
Join Date: Apr 2002
Location: East Texas
Posts: 38
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|