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

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
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,190,583
Messages
5,981,787
Members
439,735
Latest member
Tony_P

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
Top