View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
mikeg710 mikeg710 is offline
external usenet poster
 
Posts: 8
Default Populate ListBox with Filtered Records

Using Excel 2003.

I have a database worksheet named Projects, with three columns of
information: Id, Name, and Location. The worksheet currently has over 200
records.

My VBA form (frmMainMenu) has a ComboBox (cboSelectLocation), CommandButton
(cmdListProjects), and a ListBox (lstProjectsByLocation).

Using the VBA code example from http://j-walk.com/ss/excel/tips/tip47.htm, I
am able to populate the ComboBox with a list of unique, nonduplicated
Locations from the Projects worksheet.

What I am getting stuck on is when the user selects the Location from the
ComboBox, clicking the CommandButton should populate the ListBox with all the
records that match the Location (a filtered list by Location, if you will).

Can anyone help with the VBA code that would sort through the records of the
worksheet to select only the ones that match the Location?