p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Excel VBA (http://p2p.wrox.com/forumdisplay.php?f=79)
-   -   multiple Listbox values in another listbox (http://p2p.wrox.com/showthread.php?t=59499)

terryv June 27th, 2007 07:01 AM

multiple Listbox values in another listbox

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


All times are GMT -4. The time now is 01:30 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.