Hi everyone,
I'm new to VBA-Excel and was wondering if you would happen to know how to add the same items to multiple combo boxes.
I want to set up 31 combo boxes that will contain the same items, without having to do it manually.
So far this is what my code looks like:
As you can see it's very repetitive and time consuming.Code:With Worksheets("January") .ComboBox1.Clear .ComboBox1.AddItem "Regular" .ComboBox1.AddItem "Vacation" .ComboBox1.AddItem "Statutory" .ComboBox1.AddItem "CT - Half" .ComboBox1.AddItem "CT - Full" .ComboBox1.Text = .ComboBox1.List(0) .ComboBox2.Clear .ComboBox2.AddItem "Regular" .ComboBox2.AddItem "Vacation" .ComboBox2.AddItem "Statutory" .ComboBox2.AddItem "CT - Half" .ComboBox2.AddItem "CT - Full" .ComboBox2.Text = .ComboBox2.List(0) .ComboBox3.Clear .ComboBox3.AddItem "Regular" .ComboBox3.AddItem "Vacation" .ComboBox3.AddItem "Statutory" .ComboBox3.AddItem "CT - Half" .ComboBox3.AddItem "CT - Full" .ComboBox3.Text = .ComboBox3.List(0) End With
Any help would be greatly appreciated.




Reply With Quote