Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I just finished a project, and everything works fine, but there is some pretty clunky-looking code making it work. Here's part of my Form Reset code, which illustrates what I'm talking about: ----- UserForm1.CommandButton1.BackColor = vbButtonFace UserForm1.CommandButton2.BackColor = vbButtonFace UserForm1.CommandButton3.BackColor = vbButtonFace UserForm1.CommandButton4.BackColor = vbButtonFace UserForm1.CommandButton5.BackColor = vbButtonFace UserForm1.CommandButton6.BackColor = vbButtonFace UserForm1.CommandButton7.BackColor = vbButtonFace UserForm1.CommandButton8.BackColor = vbButtonFace UserForm1.CommandButton9.BackColor = vbButtonFace UserForm1.CommandButton10.BackColor = vbButtonFace UserForm1.CommandButton11.BackColor = vbButtonFace UserForm1.CommandButton12.BackColor = vbButtonFace UserForm1.CommandButton13.BackColor = vbButtonFace UserForm1.CommandButton14.BackColor = vbButtonFace UserForm1.CommandButton15.BackColor = vbButtonFace UserForm1.CommandButton16.BackColor = vbButtonFace UserForm1.CommandButton17.BackColor = vbButtonFace UserForm1.CommandButton18.BackColor = vbButtonFace UserForm1.CommandButton19.BackColor = vbButtonFace UserForm1.CommandButton20.BackColor = vbButtonFace ----- I had to do this sort of thing with several different controls. It seems to me that there ought to be a more elegant way of doing this sort of thing. Is it possible to reference controls with a variable? Is there a better way of doing this? -- Teodomiro ------------------------------------------------------------------------ Teodomiro's Profile: http://www.excelforum.com/member.php...o&userid=33140 View this thread: http://www.excelforum.com/showthread...hreadid=537239 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
referencing forms controls | Excel Programming | |||
Referencing worksheet controls | Excel Programming | |||
Code to access Controls via variables? | Excel Programming | |||
Referencing Variables | Excel Worksheet Functions | |||
Referencing to controls on a worksheet | Excel Programming |