ca1358
asked on
Clear a Static Event
I am using Excel VBA
Is there any way to clear the static event when you click the Refresh Button?
Any help would greatly be appreciated!
Private Sub Commandbutton28_Click()
Static intCounter As Integer
intCounter = intCounter + 1
MsgBox "Clicked" & " " & intCounter
End Sub
Private Sub cbRefresh_Click()
End Sub
Is there any way to clear the static event when you click the Refresh Button?
Any help would greatly be appreciated!
Private Sub Commandbutton28_Click()
Static intCounter As Integer
intCounter = intCounter + 1
MsgBox "Clicked" & " " & intCounter
End Sub
Private Sub cbRefresh_Click()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!
You would have to make intCounter a module level variable and simply reset it:
Dim intCounter As Integer
Private Sub Commandbutton28_Click()
intCounter = intCounter + 1
MsgBox "Clicked" & " " & intCounter
End Sub
Private Sub cbRefresh_Click()
intCounter = 0
End Sub