ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   reset the value of a spin button (https://www.excelbanter.com/excel-programming/441420-reset-value-spin-button.html)

cubbybear3

reset the value of a spin button
 
Q: How can I reset the value of a spin button with out setting off the
CHANGE event?
I am using Office Pro 2003 and have tried the following with out
success:

Application.EnableEvents = False
spnButton1.Value = VarX
Application.EnableEvents = True


Bob Phillips[_4_]

reset the value of a spin button
 
Option Explicit

Private fNoChange As Boolean

'other code

Private Sub spnButton1_Change()
If Not fNoChange Then

'change code
End If
End Sub


'more code

fNoChange = True
spnButton1.Value = VarX
fNoChange = False

--

HTH

Bob

"cubbybear3" wrote in message
...
Q: How can I reset the value of a spin button with out setting off the
CHANGE event?
I am using Office Pro 2003 and have tried the following with out
success:

Application.EnableEvents = False
spnButton1.Value = VarX
Application.EnableEvents = True




cubbybear3

reset the value of a spin button
 
On Apr 7, 2:58*pm, "Bob Phillips" wrote:
Option Explicit

Private fNoChange As Boolean

'other code

Private Sub spnButton1_Change()
* * If Not fNoChange Then

* * * * 'change code
* * End If
End Sub

'more code

fNoChange = True
spnButton1.Value = VarX
fNoChange = False

--

HTH

Bob

"cubbybear3" wrote in message

...

Q: How can I reset the value of a spin button with out setting off the
CHANGE event?
I am using Office Pro 2003 and have tried the following with out
success:


Application.EnableEvents = False
spnButton1.Value = VarX
Application.EnableEvents = True


Well, I still haven't figured out EXACTLY how it works, but it
does.
Mucho gracias Bob.

Bob Phillips[_4_]

reset the value of a spin button
 
Basically, I am adding my own version of enableevents by using a boolean
variable to determine whether the code executes or not.

--

HTH

Bob

"cubbybear3" wrote in message
...
On Apr 7, 2:58 pm, "Bob Phillips" wrote:
Option Explicit

Private fNoChange As Boolean

'other code

Private Sub spnButton1_Change()
If Not fNoChange Then

'change code
End If
End Sub

'more code

fNoChange = True
spnButton1.Value = VarX
fNoChange = False

--

HTH

Bob

"cubbybear3" wrote in message

...

Q: How can I reset the value of a spin button with out setting off the
CHANGE event?
I am using Office Pro 2003 and have tried the following with out
success:


Application.EnableEvents = False
spnButton1.Value = VarX
Application.EnableEvents = True


Well, I still haven't figured out EXACTLY how it works, but it
does.
Mucho gracias Bob.




All times are GMT +1. The time now is 07:06 AM.

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