jproffer
08-14-2008, 06:27 AM
Well, as you might have guessed, I would like to add a counter to count the number of times a code has been ran. I (think I) understand how to use a counter in a loop:
counter = counter +1
But that doesn't save the last count. At runtime, it's zero until that line is passed, at which time it becomes 1, but then at next runtime, it starts at zero again.
This is not a loop code, so that won't work.
To give a little background too, here's what I'm ultimately trying to accomplish:
I have a button (forms menu button) on a sheet. That button is labeled "Normal". It locks and hides all sheets, makes several toolbars invisible, among other things that don't matter...I can code all that. But I would like to use it as sort of a toggle button. Click once (or on an odd runtime count) and the button caption changes to "Developer" (hides toolbars, scroll bars, sheet tabs, locks sheets, etc.), click again (every even runtime count) and the button caption changes back to "Normal" and goes into "developer mode", basically showing "what will this button do NEXT time I click it"
Also, if there is such a thing as an execution-counter...then how would I determine even or odd...I tried If IsOdd counter....If counter = Odd....it errors out at that line each time.
At any rate, thank you all in advance. Sorry for the long post.
counter = counter +1
But that doesn't save the last count. At runtime, it's zero until that line is passed, at which time it becomes 1, but then at next runtime, it starts at zero again.
This is not a loop code, so that won't work.
To give a little background too, here's what I'm ultimately trying to accomplish:
I have a button (forms menu button) on a sheet. That button is labeled "Normal". It locks and hides all sheets, makes several toolbars invisible, among other things that don't matter...I can code all that. But I would like to use it as sort of a toggle button. Click once (or on an odd runtime count) and the button caption changes to "Developer" (hides toolbars, scroll bars, sheet tabs, locks sheets, etc.), click again (every even runtime count) and the button caption changes back to "Normal" and goes into "developer mode", basically showing "what will this button do NEXT time I click it"
Also, if there is such a thing as an execution-counter...then how would I determine even or odd...I tried If IsOdd counter....If counter = Odd....it errors out at that line each time.
At any rate, thank you all in advance. Sorry for the long post.