Spin Button update issue

Mammon

New Member
Joined
Feb 26, 2014
Messages
10
Hi, I'm new to this forum and still quite green when it comes to excel so I was hoping that someone would have a fix for a minor issue I've been having.

I'm trying to use spin buttons to increase or decrease cells (B5:B11, one button per cell), with a range of 1 to 10, however I would like an 8th cell (B12) that decreases by an amount equal to the above cells' increases and that cannot be reduced beyond 0 (Cell B12 just contains "=40-SUM[B5:B11]). The idea is that there are 40 points that can be distributed amongst the 7 cells with the 8th being overflow. I seem to have just about gotten it; this is the code I've worked out for my buttons:

Private Sub SpinButton1_Change()
Dim Smax As Variant

If Range("B12") = 0 Then
Smax = Range("B5")
ElseIf Range("B5") = 10 Then
Smax = 10
Else: Smax = Range("B5") + Range("B12")
End If

SpinButton1.Max = Smax

End Sub

If I distribute all 40 points all of the maximums are set properly to the present value of that cell, however if I then subtract a point from one cell only the maximum for that cell is recalculated and the other cells retain their present maximum despite there being one extra point to distribute. Subtracting a point from one of the other cells causes it to update its new maximum so this is a minor issue and the sheet is usable as is, however I'd like to get it figured out if possible. Any thoughts on how to get each cell to update its maximum without having to first subtract?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,519
Messages
6,125,294
Members
449,218
Latest member
Excel Master

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