Hi Everyone
I am pretty new to VBA so this might be well understood (and posted elsewhere but I did look and couldn't find it so sorry if this has been answered many times)
Basically I am try to use two list boxes (ListBox1, ListBox2). ListBox2 is populated data derived from what is chosen from the list in ListBox1. The list in ListBox2 is variable and ranges from 1 item to 350 items dependent on the value picked up in ListBox1
Here's the issue when there are more than one items generated for ListBox2 everything is fine and ListBox2 is populated. But if only one item is found by choosing a certain ListBox1 value then my code crashes.
Here's the code snippet: The derived list values are placed in Row K (11), Counter is a loop counter for number of entries found for listBox2
This ok until Counter -1 = 1 i.e the expression is ".List = Range(Cells(1, 11),Cells(1, 11)).value" (There's a -1 because counter is counting in a loop adding +1 each condition so will come out of the loop one too high) giving Run-Time Error 381: Could not set the list property: Invalid Property Array Index
However if I "pad" the value like the code snippet below it works
So the .list value is two discreet cells in the sheet rather than one. The value in Cells(1,12)="" but this seems to satisfy VBA.
Can anyone tell me what's going on?
Thanks, Nick
Bookmarks