Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same Items in 3 different Combo Boxes
I have three Combo Boxes in a UserForm that I need to display all 50 state
initials. I usually write my code like this: Private Sub UserForm_Initialize() With cboCustomerST .AddItem "GA" .AddItem "TN" .AddItem "NY" 'list all other state End With End Sub Is there a faster way to do this with 2 other combo boxes instead writing code for each combo box? Thanks in Advance, Ryan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same Items in 3 different Combo Boxes
for i = 1 to 3
userform1.controls("ComboBox" & i).additem "GA" next i Thats what I usually do. "RyanH" wrote: I have three Combo Boxes in a UserForm that I need to display all 50 state initials. I usually write my code like this: Private Sub UserForm_Initialize() With cboCustomerST .AddItem "GA" .AddItem "TN" .AddItem "NY" 'list all other state End With End Sub Is there a faster way to do this with 2 other combo boxes instead writing code for each combo box? Thanks in Advance, Ryan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same Items in 3 different Combo Boxes
Another way... Me.ComboBox2.List = Me.ComboBox1.List -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "RyanH" < wrote in message I have three Combo Boxes in a UserForm that I need to display all 50 state initials. I usually write my code like this: Private Sub UserForm_Initialize() With cboCustomerST .AddItem "GA" .AddItem "TN" .AddItem "NY" 'list all other state End With End Sub Is there a faster way to do this with 2 other combo boxes instead writing code for each combo box? Thanks in Advance, Ryan |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Same Items in 3 different Combo Boxes
You could do it this way...
Dim S As Variant For Each S In Split("AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA " & _ "KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ " & _ "NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT " & _ "VA WA WV WI WY") ListBox1.AddItem S ListBox2.AddItem S ListBox3.AddItem S Next Rick "RyanH" wrote in message ... I have three Combo Boxes in a UserForm that I need to display all 50 state initials. I usually write my code like this: Private Sub UserForm_Initialize() With cboCustomerST .AddItem "GA" .AddItem "TN" .AddItem "NY" 'list all other state End With End Sub Is there a faster way to do this with 2 other combo boxes instead writing code for each combo box? Thanks in Advance, Ryan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Getting Combo boxes to change options based on other Combo boxes. | New Users to Excel | |||
Selecting subsets using combo boxes or list boxes | Excel Discussion (Misc queries) | |||
Questions on combo boxes and list boxes. | New Users to Excel | |||
Filtered list for Combo Box ListFillRange - Nested Combo Boxes | Excel Programming | |||
List boxes/combo boxes | Excel Programming |