#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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
combo reference on another combo box for picking address etc. kbjin Excel Worksheet Functions 1 December 8th 06 03:29 PM
Excel VBA Combo Box Populating dependent on other combo box choices ikabodred Excel Programming 1 March 15th 06 03:16 PM
Filtered list for Combo Box ListFillRange - Nested Combo Boxes DoctorG Excel Programming 3 February 23rd 06 12:15 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM


All times are GMT +1. The time now is 09:47 AM.

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"