Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Combo boxes to change options based on other Combo boxes. Ancient Wolf New Users to Excel 1 March 27th 09 06:29 PM
Selecting subsets using combo boxes or list boxes CLamar Excel Discussion (Misc queries) 0 June 1st 06 07:43 PM
Questions on combo boxes and list boxes. Marc New Users to Excel 1 March 14th 06 09:40 AM
Filtered list for Combo Box ListFillRange - Nested Combo Boxes DoctorG Excel Programming 3 February 23rd 06 12:15 PM
List boxes/combo boxes Tibow Excel Programming 3 February 17th 04 12:35 PM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"