Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box Item

How to add item in combo box with values from 2 different columns
Thank'

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Combo Box Item

Hi there

Do you want a list of two sets of values?

Col 1, Item 1 Col2, Item 1
Col 1, Item 2 Col2, Item 2
Col 1, Item 3 Col2, Item 3
Col 1, Item 4 Col2, Item 4

Or a single list made up of the two columns?

Col1,Item1 & Col2, Item1
Col1,Item2 & Col2, Item2
Col1,Item3 & Col2, Item3
Col1,Item4 & Col2, Item4

Or a single column with entries from two columns?

Col1,Item1
Col1,Item2
Col1,Item3
Col1,Item4
Col2, Item1
Col2, Item2
Col2, Item3
Col2, Item4

Are the two columns next to each other (e.g. Col A & B)?

====

Basically you can either use

combobox1.additem range("a10").value to add one value at a time (or use
variables add a range)

or you can use the

combobox1.rowsource ("a1:b10") to add multiple values at once (this
actually links the items in the combobox to the cells on the sheet)

Hope this gives you some ideas - if you want more information, answer the
questions above and I'll look tomorrow once I'm over my hangover!

Best wishes

David



"alfaboost" wrote in message
...
How to add item in combo box with values from 2 different columns?
Thank's


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box Item

Thank's for david, but i still got the problem.
I have data like this:

A B
1 10 11
2 12 13
3 14 15
4 16 17
5 18 19

I like those data shows in combobox item like this :

10
11
12
13
14
15
16
17
18
19

So, if i want those data shows as item in combobox from the control box
menu, what should i do? I' ve try this :

Private Sub ComboBox1_Change()
ComboBox1.AddItem Range("a1: b5")
End Sub

But why it still doesn't work? am i made mistake or there's something
that i don't know? please give me advise...Thank's


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box Item

Thank's for david, but i still got the problem.
I have data like this:

Col A Col B
1 10 11
2 12 13
3 14 15
4 16 17
5 18 19

I like those data shows in combobox item like this :

10
11
12
13
14
15
16
17
18
19

So, if i want those data shows as item in combobox from the control box
menu, what should i do? I' ve try this :

Private Sub ComboBox1_Change()
ComboBox1.AddItem Range("a1: b5")
End Sub

But why it still doesn't work? am i made mistake or there's something
that i don't know? please give me advise...Thank's


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Combo Box Item

Private Sub UserForm_Initialize()
Dim i As Integer

For i = 1 To 5
ComboBox1.AddItem Cells(i, 1).Value
ComboBox1.AddItem Cells(i, 2).Value
Next
End Sub


Rob


"alfaboost " wrote in message
...
Thank's for david, but i still got the problem.
I have data like this:

Col A Col B
1 10 11
2 12 13
3 14 15
4 16 17
5 18 19

I like those data shows in combobox item like this :

10
11
12
13
14
15
16
17
18
19

So, if i want those data shows as item in combobox from the control box
menu, what should i do? I' ve try this :

Private Sub ComboBox1_Change()
ComboBox1.AddItem Range("a1: b5")
End Sub

But why it still doesn't work? am i made mistake or there's something
that i don't know? please give me advise...Thank's


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Combo Box Item

David,

If I may ask a question here..

How would I populate a list box data using a single list of information from 2 columns? 'Col1,Item1 & Col2, Item1'

Can it be done?
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Combo Box Item

Hi Robbyn

Sub twolist()
Dim x As Integer

x = 1

UserForm1.ListBox1.Clear

While (Range("a" & x).Value < "")
UserForm1.ListBox1.AddItem Range("A" & x).Value & Range("b" &
x).Value
x = x + 1
Wend
UserForm1.Show

End Sub

will do exactly that - however, you lost the useful ability to set rowsource
(ie link back to the actual sheet).

Alternatively, insert an additional column which just concatenates the two
cells that you're interested in and set the rowsource to the new combined
column.

Regards

David




"Robbyn" wrote in message
...
David,

If I may ask a question here..

How would I populate a list box data using a single list of information

from 2 columns? 'Col1,Item1 & Col2, Item1'

Can it be done?



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Combo Box Item

Okay, good idea. Thanks much

Robbyn
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
Macro to ask for a item# and then show all details for that item Durai Excel Discussion (Misc queries) 5 December 4th 09 08:17 PM
To find rate of each item from item.xls and to copy price.xls pol Excel Discussion (Misc queries) 7 July 16th 09 12:49 AM
Item numbers result in item description in next field in Excel Cheryl MM Excel Worksheet Functions 1 February 20th 07 03:51 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
Selecting an Item from a List and getting a different item to pop. Matt Excel Worksheet Functions 1 December 7th 04 02:37 PM


All times are GMT +1. The time now is 10:54 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"