Spinbuttons on input boxes

BDrew

Board Regular
Joined
Jun 8, 2008
Messages
79
I have a Lightcode variable that can be 1 to 9-9-9-9-9-9 on an Input box with 6 Spinbuttons next to 6 input Text Boxes, representing each digit,the code associated with each textbox and spin button limits the min 0 and max9 and they are set visible False unless the digit immediately to the left has a digit greater than zero. The code was repeated 6 times but worked superficially in that digit 1 and 3 might have a digit and digit 2 can disappear leaving digit 3 in place to cause an error. I am faced with adding further code to loop 2:6,3:6....5:6 on the way up and on the way down again, a lot of code(messy), which makes me think that I am missing something simpler.

Any suggestion would be welcome.

A sample of the first set of code(repeated 5 times) is shown below..

'This procedure decrements the LightCode shown in
'LightCode1 when you decrease the value of the
'SpinButton.
Private Sub LCSpinButton1_SpinDown()
If LightCode1.Value = 0 Then
LightCode1.Value = 0
LightCode2.Visible = False
LCSpinButton2.Visible = False
Else
LightCode1.Value = (LightCode1.Value) - 1
End If
End Sub
'This procedure increments the LightCode shown in
'LightCode1 when you increase the value of the
'SpinButton(max9).
Private Sub LCSpinButton1_SpinUp()
If LightCode1.Value = 9 Then
LightCode1.Value = 9
Else
LightCode1.Value = (LightCode1.Value) + 1
End If

If LightCode1.Value = 1 Then
LightCode2.Visible = True
LCSpinButton2.Visible = True
End If

End Sub

regards

BDrew
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,214,875
Messages
6,122,040
Members
449,063
Latest member
ak94

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