View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Adding range search results to multi-column listbox

Hi Ken

You don't need an array. It can be done like this. Just remember to
change ColumnCount in Listbox properties to 2 :

For Each Cell In Range("StoreList")
If Cell.Value = strGroupName Then
strStore = Cell.Offset(0, -3).Value
With Me.lstStores
.AddItem (strStore)
.List(.ListCount - 1, 1) = strGroupName
End With
End If
Next Cell

Regards,
Per

On 21 Apr., 20:14, Ken Warthen
wrote:
I use the following code to search through a range for store numbers given a
group number.

* * * * For Each Cell In Range("StoreList")
* * * * * * If Cell.Value = strGroupName Then
* * * * * * * * strStore = Cell.Offset(0, -3).Value
* * * * * * * * Me.lstStores.AddItem (strStore)
* * * * * * End If
* * * * Next Cell

Instead of just showing the store number (strStore) in the listbox, I'd like
to have a two column listbox displaying both store number and group name
(strGroupName). *I'm assuming this would require building an array and using
the elements of the array as the record source for the multicolumn listbox,
but I'm not sure, and arrays don't work well in my brain. *Any help would be
appreciated.

Ken