Listbox to ComboBox

josros60

Well-known Member
Joined
Jun 27, 2010
Messages
780
Office Version
  1. 365
Hi,

how can i chang the code below to work in ComboBox1 instead listbox.

Code:

Code:
Private Sub ComboBox1_Change()Dim i As Integer
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
Select Case ListBox1.List(i)
Case "Allstream"
    Call Allstream
        Case "ANI NETWORKS"
    Call ANINET
        Case "AT&T"
    Call At
        Case "ATT"
    Call ATT
        Case "COGECO"
    Call MyPeer
        Case "Cogent"
    Call Cogent
     Case "CityWest"
    Call CityWest
        Case "EQUNIX"
    Call EQUINIX
        Case "BELLMTS"
    Call mts
        Case "Rogers Business Solutions"
    Call Rogers_Login
        Case "SHAW BUSINESS"
    Call SHAW
        Case "SOMOS"
    Call SomosLogin
        Case "VOXBONE"
    Call VOXBONE
        Case "TECHDATA CENTRE"
    Call TECHDATA
        Case "CANAD POST"
    Call CanadaPost
        Case "PUROLATOR COURIER"
    Call PUROLATOR
        Case "THINKTEL 913"
    Call THINKTEL20000913
        Case "THINKTEL 448"
    Call THINKTEL20000448
        Case "XO COMMUNICATIONS"
    Call XOMCOMMUNICATIONS
        Case "ZAYO ALLSTREAM"
    Call ZAYO
End Select
End If
Next i
End Sub

thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
The MultiSelect property does not exist in the combobox, I suppose, you are only going to select an item, then

Code:
Private Sub ComboBox1_Change()
    If ComboBox1.ListIndex = -1 Then Exit Sub
    Select Case ComboBox1
        Case "Allstream":                   Call Allstream
        Case "ANI NETWORKS":                Call ANINET
        Case "AT&T":                        Call At
        Case "ATT":                         Call ATT
        Case "COGECO":                      Call MyPeer
        Case "Cogent":                      Call Cogent
        Case "CityWest":                    Call CityWest
        Case "EQUNIX":                      Call EQUINIX
        Case "BELLMTS":                     Call mts
        Case "Rogers Business Solutions":   Call Rogers_Login
        Case "SHAW BUSINESS":               Call SHAW
        Case "SOMOS":                       Call SomosLogin
        Case "VOXBONE":                     Call VOXBONE
        Case "TECHDATA CENTRE":             Call TECHDATA
        Case "CANAD POST":                  Call CanadaPost
        Case "PUROLATOR COURIER":           Call PUROLATOR
        Case "THINKTEL 913":                Call THINKTEL20000913
        Case "THINKTEL 448":                Call THINKTEL20000448
        Case "XO COMMUNICATIONS":           Call XOMCOMMUNICATIONS
        Case "ZAYO ALLSTREAM":              Call ZAYO
    End Select
End Sub
 
Upvote 0
Thank you very much.

After i right click combobox and entered in ListFillRange = LIST but dissapear when click combo is empty.

Thanks again.
 
Upvote 0
Thank you very much.

After i right click combobox and entered in ListFillRange = LIST but dissapear when click combo is empty.

Thanks again.

I did not understand. What disappears?
 
Upvote 0
when add LiST to ListFillRange property will show name in the combobox.

there is a field
ListFillRange = LIST to show the names in the combobox.

 
Upvote 0
when add LiST to ListFillRange property will show name in the combobox.

there is a field
ListFillRange = LIST to show the names in the combobox.


Sorry, but I still do not understand. Does this have to do with the code I sent you?

Is "List" a named range?

108ae292bdb514682b05626acfbc2797.jpg


Sorry, but I still do not understand. Does this have to do with the code I sent you?
List is a named range?
But the name should not appear in the combobox, what should appear in the combobox are the data contained in the named range.
 
Upvote 0
The problem is that when click the combobox doesn't show any names it's blank.
 
Upvote 0
The problem is that when click the combobox doesn't show any names it's blank.

What other properties did you modify in the combobox?
Did you modify something in the code I sent you?
Do you have other codes on your sheet?
If you give me all the information, I can help you with pleasure.
108ae292bdb514682b05626acfbc2797.jpg
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,777
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top