# Spinbuttons on input boxes

#### BDrew

##### Board Regular
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

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Replies
3
Views
404
Replies
1
Views
283
Replies
3
Views
289
Replies
1
Views
363
Replies
1
Views
303

1,191,416
Messages
5,986,430
Members
440,029
Latest member
GabSSSH

### 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.

### Which adblocker are you using?

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

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