ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo Box (https://www.excelbanter.com/excel-programming/405324-combo-box.html)

K[_2_]

Combo Box
 
Hi, i have information in one of my excel spreadsheet combo Box
(please see below)

SD - South Distance
WD - West Distance
ND - North Distancce

is it possible that when i click drop down in combo box then i can see
all the information which i mentioned above and when i select one of
it like if i select SD - South Distance then after selecting it i just
see SD in combo box. I just want to see all information in dropdown
but i want first two words to show in combo box after selecting it.
Please if anybody can give any useful idea.

Thanks.

Dave Peterson

Combo Box
 
This is a combobox from the control toolbox toolbar placed on a worksheet?

If yes, you can make the combobox show two columns in the list, but only one
boundcolumn will show up in the combobox.

Option Explicit
Sub auto_open()
With Worksheets("Sheet1").ComboBox1
.ColumnCount = 2
.BoundColumn = 1

.ListFillRange = ""
.Clear

.ColumnWidths = "25;55"

.AddItem "SD"
.List(0, 1) = "South Distance"

.AddItem "WD"
.List(1, 1) = "West Distance"

.AddItem "ND"
.List(2, 1) = "North Distancce"
End With

End Sub

I populated the combobox in the auto_open procedure--this goes in a General
module and will run each time you open your workbook.

But you could have done it manually through the properties window, too (with a
two column range somewhere in your workbook).

K wrote:

Hi, i have information in one of my excel spreadsheet combo Box
(please see below)

SD - South Distance
WD - West Distance
ND - North Distancce

is it possible that when i click drop down in combo box then i can see
all the information which i mentioned above and when i select one of
it like if i select SD - South Distance then after selecting it i just
see SD in combo box. I just want to see all information in dropdown
but i want first two words to show in combo box after selecting it.
Please if anybody can give any useful idea.

Thanks.


--

Dave Peterson

K[_2_]

Combo Box
 
On 30 Jan, 20:23, Dave Peterson wrote:
This is a combobox from the control toolbox toolbar placed on a worksheet?

If yes, you can make the combobox show two columns in the list, but only one
boundcolumn will show up in the combobox.

Option Explicit
Sub auto_open()
* * With Worksheets("Sheet1").ComboBox1
* * * * .ColumnCount = 2
* * * * .BoundColumn = 1

* * * * .ListFillRange = ""
* * * * .Clear

* * * * .ColumnWidths = "25;55"

* * * * .AddItem "SD"
* * * * .List(0, 1) = "South Distance"

* * * * .AddItem "WD"
* * * * .List(1, 1) = "West Distance"

* * * * .AddItem "ND"
* * * * .List(2, 1) = "North Distancce"
* * End With

End Sub

I populated the combobox in the auto_open procedure--this goes in a General
module and will run each time you open your workbook.

But you could have done it manually through the properties window, too (with a
two column range somewhere in your workbook).





K wrote:

Hi, i have information in one of my excel spreadsheet combo Box
(please see below)


SD - South Distance
WD - West Distance
ND - North Distancce


is it possible that when i click drop down in combo box then i can see
all the information which i mentioned above and when i select one of
it like if i select SD - South Distance then after selecting it i just
see SD in combo box. *I just want to see all information in dropdown
but i want first two words to show in combo box after selecting it.
Please if anybody can give any useful idea.


Thanks.


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Thanks for replying Dave. i am trying to use Combo Box (from
control). i know there is another Combo Box(Active X control). Can
you please explain bit more that where and how i should place the code
you send me. And is it possible for you that you can see the link
below and send me any use ful answer for it thanks.

http://www.savefile.com/files/1350632

Dave Peterson

Combo Box
 
First, I don't open unknown workbooks.

Second, do you mean you used a dropdown from the Forms toolbar? If you did,
you'll want to replace it with a combobox from the control toolbox toolbar.

Third...
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

K wrote:

On 30 Jan, 20:23, Dave Peterson wrote:
This is a combobox from the control toolbox toolbar placed on a worksheet?

If yes, you can make the combobox show two columns in the list, but only one
boundcolumn will show up in the combobox.

Option Explicit
Sub auto_open()
With Worksheets("Sheet1").ComboBox1
.ColumnCount = 2
.BoundColumn = 1

.ListFillRange = ""
.Clear

.ColumnWidths = "25;55"

.AddItem "SD"
.List(0, 1) = "South Distance"

.AddItem "WD"
.List(1, 1) = "West Distance"

.AddItem "ND"
.List(2, 1) = "North Distancce"
End With

End Sub

I populated the combobox in the auto_open procedure--this goes in a General
module and will run each time you open your workbook.

But you could have done it manually through the properties window, too (with a
two column range somewhere in your workbook).





K wrote:

Hi, i have information in one of my excel spreadsheet combo Box
(please see below)


SD - South Distance
WD - West Distance
ND - North Distancce


is it possible that when i click drop down in combo box then i can see
all the information which i mentioned above and when i select one of
it like if i select SD - South Distance then after selecting it i just
see SD in combo box. I just want to see all information in dropdown
but i want first two words to show in combo box after selecting it.
Please if anybody can give any useful idea.


Thanks.


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Thanks for replying Dave. i am trying to use Combo Box (from
control). i know there is another Combo Box(Active X control). Can
you please explain bit more that where and how i should place the code
you send me. And is it possible for you that you can see the link
below and send me any use ful answer for it thanks.

http://www.savefile.com/files/1350632


--

Dave Peterson


All times are GMT +1. The time now is 03:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com