Disabling one side of a Spinner

Farback

Board Regular
Joined
Mar 27, 2009
Messages
149
I have created an ActiveX Spinner (SpinButton1) with a range of 1 - 10. Is it possible to disable the "Up" side of the Spinner when 10 is reached and to disable the "Down" side when 1 is reached.

I realise that the Spinner will not go further than 1 or 10, but I just want the user to know that the limit has been reached.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
No, I'm afraid not.
 
Upvote 0
I just want the user to know that the limit has been reached.

Hi

You can use the SpinUp event to test the value of the Spin button against the Max value and issue a message in case the Max value has been reached.
 
Upvote 0
Code would look similar to this:
Code:
Private Sub SpinButton1_SpinUp()
    If [F36].Value = 10 Then
        MsgBox "Can not go beyond the value of Ten."
    Else
        [F36].Value = [F36].Value + 1
    End If
End Sub
Code:
Private Sub SpinButton1_SpinDown()
    If [F36].Value = 1 Then
        MsgBox "Can not go below the value of 1."
    Else
        [F36].Value = [F36].Value - 1
    End If
End Sub
Change F36 to the cell you are changing.
 
Upvote 0
Or:

Code:
Private Sub SpinButton1_SpinUp()
 
If SpinButton1.Value = SpinButton1.Max Then MsgBox "You reached the Max"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top