I
Izran
In this application I have a cell value (AUX_KW_ADJUST) that gets
adjusted by a combination of spin buttons (one for the one, ten and
hundred place). Another cell's value (FUTURE_KW_AVAILIBLE) is
evaluated to see if AUX_KW_ADJUST is gonna exceed exceed its max limit;
if it is going to exceed the spin button is disabled. The problem is
while it does succeed in disabling the spin button, the cell keep
counting as though the spin button is still being pressed (it visually
apppears to be active). So I guess I'm looking for an answer to one of
two things here - How to force the spinbutton to be
"deselected"/"deactivated" or a way to have it deselect itself (i.e.
make the counting stop). Here is the abbreviated code with just the
spinbutton aspects included:
*****WORKSHEET******
Private Sub AUX_KW_ADJUST_1_SPINBUTTON_SpinUp()
If Range("FUTURE_AVAILIBLE_KW") >= 1 Then
Range("AUX_KW_ADJUST").Value = Range("AUX_KW_ADJUST").Value + 1
End If
Call Buttons_Enabled
Call Buttons_Disabled
End Sub
Private Sub AUX_KW_ADJUST_10_SPINBUTTON_SpinUp()
If Range("FUTURE_AVAILIBLE_KW") >= 10 Then
Range("AUX_KW_ADJUST").Value = Range("AUX_KW_ADJUST").Value +
10
End If
Call Buttons_Enabled
Call Buttons_Disabled
End Sub
Private Sub AUX_KW_ADJUST_100_SPINBUTTON_SpinUp()
If Range("FUTURE_AVAILIBLE_KW") >= 100 Then
Range("AUX_KW_ADJUST").Value = Range("AUX_KW_ADJUST").Value +
100
End If
AUX_KW_ADJUST_100_SPINBUTTON.Locked = True
AUX_KW_ADJUST_100_SPINBUTTON.Locked = False
Call Buttons_Enabled
Call Buttons_Disabled
End Sub
******MODULE**********
Sub Buttons_Enabled()
If Range("FUTURE_AVAILIBLE_KW") >= 1 Then
Worksheets(1).AUX_KW_ADJUST_1_SPINBUTTON.Enabled = True _
Else Worksheets(1).AUX_KW_ADJUST_1_SPINBUTTON.Enabled = False
If Range("FUTURE_AVAILIBLE_KW") >= 10 Then
Worksheets(1).AUX_KW_ADJUST_10_SPINBUTTON.Enabled = True _
Else Worksheets(1).AUX_KW_ADJUST_10_SPINBUTTON.Enabled = False
If Range("FUTURE_AVAILIBLE_KW") >= 100 Then
Worksheets(1).AUX_KW_ADJUST_100_SPINBUTTON.Enabled = True _
Else Worksheets(1).AUX_KW_ADJUST_100_SPINBUTTON.Enabled = False
End Sub
Sub Buttons_DIsabled()
'disables several other buttons - limits the user to one action
End Sub
adjusted by a combination of spin buttons (one for the one, ten and
hundred place). Another cell's value (FUTURE_KW_AVAILIBLE) is
evaluated to see if AUX_KW_ADJUST is gonna exceed exceed its max limit;
if it is going to exceed the spin button is disabled. The problem is
while it does succeed in disabling the spin button, the cell keep
counting as though the spin button is still being pressed (it visually
apppears to be active). So I guess I'm looking for an answer to one of
two things here - How to force the spinbutton to be
"deselected"/"deactivated" or a way to have it deselect itself (i.e.
make the counting stop). Here is the abbreviated code with just the
spinbutton aspects included:
*****WORKSHEET******
Private Sub AUX_KW_ADJUST_1_SPINBUTTON_SpinUp()
If Range("FUTURE_AVAILIBLE_KW") >= 1 Then
Range("AUX_KW_ADJUST").Value = Range("AUX_KW_ADJUST").Value + 1
End If
Call Buttons_Enabled
Call Buttons_Disabled
End Sub
Private Sub AUX_KW_ADJUST_10_SPINBUTTON_SpinUp()
If Range("FUTURE_AVAILIBLE_KW") >= 10 Then
Range("AUX_KW_ADJUST").Value = Range("AUX_KW_ADJUST").Value +
10
End If
Call Buttons_Enabled
Call Buttons_Disabled
End Sub
Private Sub AUX_KW_ADJUST_100_SPINBUTTON_SpinUp()
If Range("FUTURE_AVAILIBLE_KW") >= 100 Then
Range("AUX_KW_ADJUST").Value = Range("AUX_KW_ADJUST").Value +
100
End If
AUX_KW_ADJUST_100_SPINBUTTON.Locked = True
AUX_KW_ADJUST_100_SPINBUTTON.Locked = False
Call Buttons_Enabled
Call Buttons_Disabled
End Sub
******MODULE**********
Sub Buttons_Enabled()
If Range("FUTURE_AVAILIBLE_KW") >= 1 Then
Worksheets(1).AUX_KW_ADJUST_1_SPINBUTTON.Enabled = True _
Else Worksheets(1).AUX_KW_ADJUST_1_SPINBUTTON.Enabled = False
If Range("FUTURE_AVAILIBLE_KW") >= 10 Then
Worksheets(1).AUX_KW_ADJUST_10_SPINBUTTON.Enabled = True _
Else Worksheets(1).AUX_KW_ADJUST_10_SPINBUTTON.Enabled = False
If Range("FUTURE_AVAILIBLE_KW") >= 100 Then
Worksheets(1).AUX_KW_ADJUST_100_SPINBUTTON.Enabled = True _
Else Worksheets(1).AUX_KW_ADJUST_100_SPINBUTTON.Enabled = False
End Sub
Sub Buttons_DIsabled()
'disables several other buttons - limits the user to one action
End Sub