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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,490
Messages
6,113,956
Members
448,535
Latest member
alrossman

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