Hi
I would like the numeric value of a textbox to be used to determine which one of 50 commandbuttons change its background colour. So is it possible to use the number within a commandbutton name i.e. the 4 in CommandButton4
Many thanks for any soloutions, corrections, ideas or other options
'something along the lines of
Sub search () `search button
CommandButton(TextBox1.value).BackColor = vbGreen
End sub
'to replace listing each option in this way
<Sub search () `search button>
If TextBox1 = 1 Then
CommandButton1.BackColor = vbGreen
End If
If TextBox1 = 2 then
CommandButton2.BackColor = vbGreen
End If
`etc etc
End Sub
'Also is there and easy way to select multiple buttons to change them back to red when a reset commandbutton is pressed,without having to list all 50.
'Something like
Sub resetred () `reset button
CommandButton(1-50).BackColor = vbRed
End Sub
Bookmarks