query for combobox

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am updating my internal system.
I did almost, only one thing i tryed to modify.

There is list box contains city names.
below there
I used one combo box.

from the listbox if any item get select that is display in a1 cell.
(cell part i will see)

(NOte: everything working my system proper, i want to modify these change.)

after selecting any item from list box, say india.

my user go to combo box, and here user have click on combo box drop down arrow....for seen which options are there available.

What i try to do -
instead of click on combo box, when my user select any item from list box 1, value comes in cell a1...and the next to open the drop down list automatically, insted of click the combo box.

Is it possible any way?
has the combo box have this property?

:eeek:



 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Any one...If this is done a chucky idea...i will get bonus from my boss..
 
Upvote 0
What are you trying to do?

Take a list like Country Name and then show the Regional Names for that Country?

Do you have a table with this all configured?

Can you show sample of the table?
 
Upvote 0
list box contains -
A
B
C
D

Combo box contains -
if A
A1
A2
A3

if B
B1
B2
B3

If C
C1
C2
C3

if i choose, A...this is display in cell A1.
Now instead of go with click on combo box if cell A1 <> "" then
show list combo box..

This is it.
 
Upvote 0
Take a look at this sample to see if this helps you.

I have created a userform with a listbox and combobox. Listbox Name is lstCountries and Combobox is Named cboCountryList.

When the form is initialized I am filling the listbox with some basic data.

Asia, European or Africa

If the Listbox is double clicked on one of the names it then clears the combobox and refills with the data from a sheet.

Data sample is shown below

Countries

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Calibri,Arial; FONT-SIZE: 11pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px; FONT-WEIGHT: bold"><COL style="WIDTH: 179px"><COL style="WIDTH: 108px"><COL style="WIDTH: 316px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt; FONT-WEIGHT: bold"><TD> </TD><TD>A</TD><TD>B</TD><TD>C</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">1</TD><TD>Asia</TD><TD>European</TD><TD>Africa Continent</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">2</TD><TD>Azerbaijan</TD><TD>Austria</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Algeria (People's Democratic Republic of Algeria) </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD>Bahrain</TD><TD>Belgium</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Angola (Republic of Angola) </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">4</TD><TD>Bangladesh</TD><TD>Bulgaria</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Benin (Republic of Benin) </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">5</TD><TD>Bhutan</TD><TD>Cyprus</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Botswana (Republic of Botswana)</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">6</TD><TD>Brunei</TD><TD>Czech Republic</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Burkina Faso </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">7</TD><TD>Burma</TD><TD>Denmark</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Burundi (Republic of Burundi)</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">8</TD><TD>Cambodia</TD><TD>Estonia</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Cameroon (Republic of Cameroon) </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">9</TD><TD>People's Republic of China</TD><TD>Finland</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Cape Verde (Republic of Cape Verde) </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">10</TD><TD>Cyprus</TD><TD>France</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Central African Republic (Central African Republic)</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">11</TD><TD>East Timor</TD><TD>Germany</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Chad (Republic of Chad)</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">12</TD><TD>Georgia</TD><TD>Greece</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Comoros (Union of the Comoros) </TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">13</TD><TD>Hong Kong</TD><TD>Hungary</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Côte d'Ivoire (Republic of Côte d'Ivoire)</TD></TR><TR style="HEIGHT: 18px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">14</TD><TD>India</TD><TD>Ireland</TD><TD style="FONT-FAMILY: Arial; COLOR: #333333; FONT-SIZE: 9pt">Djibouti (Republic of Djibouti)</TD></TR></TBODY></TABLE>

Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4

Code being used is as follows:

Form on Iniatilize

Private Sub UserForm_Initialize()
With Me.lstCountries
.AddItem "Asia"
.AddItem "European"
.AddItem "Africa"
End With
End Sub

Lisbox being double clicked.

Private Sub lstCountries_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Application.ScreenUpdating = False
If Me.lstCountries.Value = "Asia" Then
Me.cboCountryList.Clear
Sheets("countries").Activate
Range("a2").Select
Do Until ActiveCell.Value = ""
Me.cboCountryList.AddItem ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
ElseIf Me.lstCountries.Value = "Europe" Then
Me.cboCountryList.Clear
Sheets("countries").Activate
Range("B2").Select
Do Until ActiveCell.Value = ""
Me.cboCountryList.AddItem ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
ElseIf Me.lstCountries.Value = "Africa" Then
Me.cboCountryList.Clear
Sheets("countries").Activate
Range("C2").Select
Do Until ActiveCell.Value = ""
Me.cboCountryList.AddItem ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Loop
End If
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,753
Members
452,940
Latest member
rootytrip

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