Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Filling a List Box in Excel from an Array
Hope someone can help. I have a listbox in excel which I am trying to
populate from an array. The array is picking up certain values from a sheet depending on a previous value selected in another list box. I currently have the array code in a module. regards, Martin |
#2
|
|||
|
|||
Filling a List Box in Excel from an Array
As an example
For i = LBound(ary) To UBound(ary) Listbox1.AddItem ary(i) Next i -- HTH RP (remove nothere from the email address if mailing direct) "Martin" wrote in message ... Hope someone can help. I have a listbox in excel which I am trying to populate from an array. The array is picking up certain values from a sheet depending on a previous value selected in another list box. I currently have the array code in a module. regards, Martin |
#3
|
|||
|
|||
Filling a List Box in Excel from an Array
Another example.
Dim strArray(2) As String strArray(0) = "X" strArray(1) = "Y" strArray(2) = "Z" ListBox1.List = strArray Cheers Andy Martin wrote: Hope someone can help. I have a listbox in excel which I am trying to populate from an array. The array is picking up certain values from a sheet depending on a previous value selected in another list box. I currently have the array code in a module. regards, Martin -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
#4
|
|||
|
|||
Filling a List Box in Excel from an Array
Hi Bob,
I have done the below but having read other threads is it not possible to create a dropdown in a worksheet using the control box and then add items using VBA?? I am having to reference the control as follows worksheets("Main").shapes("List Box 2").AddItem UniArray(transnumber) I get an 'Object does not support property or method' runtime error. Is the only way around this to create a dropdown via code? "Bob Phillips" wrote: As an example For i = LBound(ary) To UBound(ary) Listbox1.AddItem ary(i) Next i -- HTH RP (remove nothere from the email address if mailing direct) "Martin" wrote in message ... Hope someone can help. I have a listbox in excel which I am trying to populate from an array. The array is picking up certain values from a sheet depending on a previous value selected in another list box. I currently have the array code in a module. regards, Martin |
#5
|
|||
|
|||
Filling a List Box in Excel from an Array
Martin,
If you added the control from the controls toolbox, you need to use worksheets("Main").ListBox2.AddItem UniArray(transnumber) or worksheets("Main").oleobjects("ListBox2").object.A ddItem UniArray(transnumber) -- HTH RP (remove nothere from the email address if mailing direct) "Martin" wrote in message ... Hi Bob, I have done the below but having read other threads is it not possible to create a dropdown in a worksheet using the control box and then add items using VBA?? I am having to reference the control as follows worksheets("Main").shapes("List Box 2").AddItem UniArray(transnumber) I get an 'Object does not support property or method' runtime error. Is the only way around this to create a dropdown via code? "Bob Phillips" wrote: As an example For i = LBound(ary) To UBound(ary) Listbox1.AddItem ary(i) Next i -- HTH RP (remove nothere from the email address if mailing direct) "Martin" wrote in message ... Hope someone can help. I have a listbox in excel which I am trying to populate from an array. The array is picking up certain values from a sheet depending on a previous value selected in another list box. I currently have the array code in a module. regards, Martin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel array formulas | Excel Discussion (Misc queries) | |||
Can't publish Excel list to Sharepoint | Excel Discussion (Misc queries) | |||
Excel List range, filter arrows disappeared | Excel Discussion (Misc queries) | |||
Excel 2003: Match one list against another and highlight differenc | Excel Worksheet Functions | |||
Excel Auto Filter: WHY'S SORT @ TOP OF LIST? WHEN I KEY TO "SHOW . | Excel Worksheet Functions |