apgriffiths
Board Regular
- Joined
- Jun 2, 2006
- Messages
- 99
Hi i have a form with two combo boxes, one that specifies a date and one that specifies a location. I also have a third combo box that i want to populate with a corressponding list from a worksheet eg,
When i selct the date and location from the first two combo boxes i want the third to only show me the available routes for that location on that day.
I already have the following code for adding items to a lcombo box,<font face=Courier New><SPAN style="color:#00007F">Public</SPAN><SPAN style="color:#00007F">Sub</SPAN> AddItems()<br><SPAN style="color:#00007F">Dim</SPAN> AllCells<SPAN style="color:#00007F">As</SPAN> Range, Cell<SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">Dim</SPAN> NoDupes<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">New</SPAN> Collection<br><br> <SPAN style="color:#00007F">On</SPAN><SPAN style="color:#00007F">Error</SPAN><SPAN style="color:#00007F">Resume</SPAN><SPAN style="color:#00007F">Next</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> AllCells = Sheets("Sheet1").Range("A1:D10")<br> <br> <SPAN style="color:#00007F">For</SPAN><SPAN style="color:#00007F">Each</SPAN> Cell<SPAN style="color:#00007F">In</SPAN> AllCells<br> NoDupes.Add Cell.Value,<SPAN style="color:#00007F">CStr</SPAN>(Cell.Value)<br> <SPAN style="color:#00007F">Next</SPAN> Cell<br> <br> <SPAN style="color:#00007F">For</SPAN><SPAN style="color:#00007F">Each</SPAN> Item<SPAN style="color:#00007F">In</SPAN> NoDupes<br> cbCombo.AddItem Item<br> <SPAN style="color:#00007F">Next</SPAN> Item<br> <br><SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">Sub</SPAN></FONT>
How do i manage to just pick out the selected date and location??
Book1 | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Date | LocationName | LocationRef | Route | ||
2 | 12/05/2008 | Aberdeen | 1663 | 0 | ||
3 | 12/05/2008 | Aberdeen | 1663 | 101 | ||
4 | 12/05/2008 | Aberdeen | 1663 | 102 | ||
5 | 12/05/2008 | Aberdeen | 1663 | 103 | ||
6 | 12/05/2008 | Aberdeen | 1663 | 104 | ||
7 | 13/05/2008 | Aberdeen | 1663 | 105 | ||
8 | 13/05/2008 | Aberdeen | 1663 | 106 | ||
9 | 13/05/2008 | Aberdeen | 1663 | 107 | ||
10 | 13/05/2008 | Aberdeen | 1663 | 108 | ||
11 | 13/05/2008 | Aberdeen | 1663 | 109 | ||
12 | 14/05/2008 | Aberdeen | 1663 | 110 | ||
13 | 14/05/2008 | Aberdeen | 1663 | 111 | ||
14 | 14/05/2008 | Aberdeen | 1663 | 112 | ||
15 | 14/05/2008 | Aberdeen | 1663 | 208 | ||
16 | 14/05/2008 | Aberdeen | 1663 | 422 | ||
17 | 14/05/2008 | Aberdeen | 1663 | 581 | ||
Sheet1 |
When i selct the date and location from the first two combo boxes i want the third to only show me the available routes for that location on that day.
I already have the following code for adding items to a lcombo box,<font face=Courier New><SPAN style="color:#00007F">Public</SPAN><SPAN style="color:#00007F">Sub</SPAN> AddItems()<br><SPAN style="color:#00007F">Dim</SPAN> AllCells<SPAN style="color:#00007F">As</SPAN> Range, Cell<SPAN style="color:#00007F">As</SPAN> Range<br><SPAN style="color:#00007F">Dim</SPAN> NoDupes<SPAN style="color:#00007F">As</SPAN><SPAN style="color:#00007F">New</SPAN> Collection<br><br> <SPAN style="color:#00007F">On</SPAN><SPAN style="color:#00007F">Error</SPAN><SPAN style="color:#00007F">Resume</SPAN><SPAN style="color:#00007F">Next</SPAN><br> <br> <SPAN style="color:#00007F">Set</SPAN> AllCells = Sheets("Sheet1").Range("A1:D10")<br> <br> <SPAN style="color:#00007F">For</SPAN><SPAN style="color:#00007F">Each</SPAN> Cell<SPAN style="color:#00007F">In</SPAN> AllCells<br> NoDupes.Add Cell.Value,<SPAN style="color:#00007F">CStr</SPAN>(Cell.Value)<br> <SPAN style="color:#00007F">Next</SPAN> Cell<br> <br> <SPAN style="color:#00007F">For</SPAN><SPAN style="color:#00007F">Each</SPAN> Item<SPAN style="color:#00007F">In</SPAN> NoDupes<br> cbCombo.AddItem Item<br> <SPAN style="color:#00007F">Next</SPAN> Item<br> <br><SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">Sub</SPAN></FONT>
How do i manage to just pick out the selected date and location??