Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Combo Box Item
Okay, good idea. Thanks much
Robbyn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to ask for a item# and then show all details for that item | Excel Discussion (Misc queries) | |||
To find rate of each item from item.xls and to copy price.xls | Excel Discussion (Misc queries) | |||
Item numbers result in item description in next field in Excel | Excel Worksheet Functions | |||
"Combo Box - getting control combo box to stick in place in worksh | Excel Discussion (Misc queries) | |||
Selecting an Item from a List and getting a different item to pop. | Excel Worksheet Functions |