Spin Button - goes back to start and looping

jmrdigital

New Member
Joined
Jul 7, 2016
Messages
7
Hi all,

I've got a spin button going from 1 to 5 with a linked cell. Depending on the number, a pivot will change it's row labels.

To make it easy, if we are at 5 and someone clicks right, I want it to go back to 1 and if it's 1 and someone presses left, it goes to 5. Basically I want a continuous loop.

Can this be done?

Thanks,

John.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Perhaps:-
Code:
Private Sub SpinButton1_SpinDown()
With SpinButton1
    .Max = 6: .Min = 0
    .Value = IIf(.Value = 0, 5, .Value)
End With
End Sub
Private Sub SpinButton1_SpinUp()
With SpinButton1
    .Max = 6: .Min = 0
    .Value = IIf(.Value = 6, 1, .Value)
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,941
Members
448,534
Latest member
benefuexx

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