Hi,

I'm working with Excel 2003 VBA. I have a UserForm with 10 ComboBoxes.
And I have an general input. The ComBoboxes are filled dynamically , they have more or less items depending on this input.
When this input is less than a defined value, I disable e.g. ComboBox10. and so on. Below is part of the code (how I fill and how I disable).
I would like to know an efficient way to write a less code as possible when I need to disable several ComboBoxes.
Code used to fill part of them using an array:
VB Code:
  1. With ComboBox2
  2.                   For index = 1 To Num
  3.                            .AddItem RackID(index)
  4.                   Next index
  5.          End With
  6.        With ComboBox3
  7.                   For index = 1 To Num
  8.                            .AddItem RackID(index)
  9.                   Next index
  10.          End With
etc etc....
Code used to disable them:
VB Code:
  1. If Num = 5 Then 'MyCell8 = 40000
  2.                   With ComboBox6
  3.                            .Enabled = False
  4.                            .BackColor = &H8000000F
  5.                   End With
  6.                   With ComboBox7
  7.                            .Enabled = False
  8.                            .BackColor = &H8000000F
  9.                   End With
  10.                   With ComboBox8
  11.                            .Enabled = False
  12.                            .BackColor = &H8000000F
  13.                   End With
  14.                   With ComboBox9
  15.                            .Enabled = False
  16.                            .BackColor = &H8000000F
  17.                   End With
  18.                   With ComboBox10
  19.                            .Enabled = False
  20.                            .BackColor = &H8000000F
  21.                   End With
  22.          End If
I can say that Im a newbie. Thanks for your help,
Mafe