View Single Post
  #1 (permalink)  
Old June 27th, 2007, 08:01 AM
terryv terryv is offline
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default multiple Listbox values in another listbox

Hello

I have 2 listboxes in Excel 2003. I populate one listbox with an external source (Access table using Get External data/database query) rangename is companies. No problem with the first listbox, but the second listbox would be populated based on the selected item in the first listbox. In essence, the second listbox would have multiple results when an item is selected in the first listbox. I have also brought the values from a second table using the same method to display the quotes (rangename is quotes)

What I need to be able to do is to populate listbox2 using a vlookup, but I cannot seem to get any results in listbox2.

Here is my code at this point:

Function Getquotevalues()
Dim rng As Range
Dim srchstr As String
srchstr = Me.lbcompanies.Value
Set rng = Range("Quotes")
Getquotevalues = Application.WorksheetFunction.VLookup(srchstr, rng, 2, False)
End Function

Thank you for any help you can provide

Terry

Reply With Quote