Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Mulitcolumn listbox - Add Item
How do I add a row with two values in a listbox?
I thought I could just do listbox.additem("a1","a2") but it does not work. Helge |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Mulitcolumn listbox - Add Item
Maybe...
dim myRng as range dim myCell as range set myrng = worksheets("somesheethere").range("a1:A10") for each mycell in myrng.cells With me.listbox1 .AddItem myCell.Value .List(.ListCount - 1, 1) = myCell.Offset(0, 1).Value end with next mycell ======== Depending on what you're doing, you may be able to do it in one step. me.listbox1.list = worksheets("somesheethere").range("a1:b10").value Helge's wrote: How do I add a row with two values in a listbox? I thought I could just do listbox.additem("a1","a2") but it does not work. Helge -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Mulitcolumn listbox - Add Item
Thank you very much.
What I want to do is to take data from a database with ADO and put it in a listbox with several columns. Then I thougth additem should be quite easy. Helge On 6 Aug, 14:02, Dave Peterson wrote: Maybe... dim myRng as range dim myCell as range set myrng = worksheets("somesheethere").range("a1:A10") for each mycell in myrng.cells With me.listbox1 .AddItem myCell.Value .List(.ListCount - 1, 1) = myCell.Offset(0, 1).Value end with next mycell ======== Depending on what you're doing, you may be able to do it in one step. me.listbox1.list = worksheets("somesheethere").range("a1:b10").value Helge's wrote: How do I add a row with two values in a listbox? I thought I could just do listbox.additem("a1","a2") but it does not work. Helge -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Mulitcolumn listbox - Add Item
I don't use ADO, but I would think that once you got your data refreshed in a
worksheet (via ADO???), then the code would work ok. But that's a guess. Helge's wrote: Thank you very much. What I want to do is to take data from a database with ADO and put it in a listbox with several columns. Then I thougth additem should be quite easy. Helge On 6 Aug, 14:02, Dave Peterson wrote: Maybe... dim myRng as range dim myCell as range set myrng = worksheets("somesheethere").range("a1:A10") for each mycell in myrng.cells With me.listbox1 .AddItem myCell.Value .List(.ListCount - 1, 1) = myCell.Offset(0, 1).Value end with next mycell ======== Depending on what you're doing, you may be able to do it in one step. me.listbox1.list = worksheets("somesheethere").range("a1:b10").value Helge's wrote: How do I add a row with two values in a listbox? I thought I could just do listbox.additem("a1","a2") but it does not work. Helge -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Double click item in Listbox to select item and close Listbox | Excel Programming | |||
Listbox Item Focus | Excel Programming | |||
listbox add item | Excel Programming | |||
Add item to listbox, but only if it is not already there. | Excel Programming | |||
The value of a ListBox Item | Excel Programming |