Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
| Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 27th, 2007, 07:01 AM
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



Similar Threads
Thread Thread Starter Forum Replies Last Post
To highlight multiple selected values in listbox lily611 General .NET 7 August 20th, 2007 12:59 AM
Applying Multiple Selected Values to a Listbox rit01 ASP.NET 2.0 Professional 1 December 15th, 2006 07:12 AM
Using Values from a ListBox timmaher Classic ASP Databases 2 September 14th, 2005 10:01 AM
Values from a ListBox mrideout BOOK: Beginning ASP.NET 1.0 0 December 1st, 2004 09:53 AM
Listbox Values Louisa VB.NET 2002/2003 Basics 1 February 13th, 2004 01:28 PM





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