Filter Validation List by other drop down

vtapia

New Member
Joined
Jun 22, 2011
Messages
5
Hi, Im having a bit of trouble coming up with a way to have a data validation drop down that is filtered depending on a date, the only problem is that the date is in "Year-Period-Week" (11-05-3) format so I am wondering how I can:

1. search substring (sorry, don't know VBA equivalent :laugh:)for each set of data (Year, Period, Week) of these dates then probably have 3 separate drop downs for each of these

2. once I have the 3 drop downs, I would like to be able to filter my original drop down based on the values given (im assuming i'll have to take the date values and concatenate them again to their original format, as that's how they are in my data sheet) then match them against my data sheet to populate the drop down.

Now, I think I should probably create a dictionary of each of the date components then use that to match up each individual component to my data, is there any other way, maybe easier way I could do this? :biggrin:

This is my code so far, no attempts to do any of the above yet though
Code:
Sub Refresh_BPName()
    Dim ws_Dest1 As Worksheet
    Dim ws_Srce1 As Worksheet
    Dim BRN As Double
    Dim prdDate As String 'first set of dates (Yr-Period-Week format)
    Dim insDate As String '2nd set of dates (same format)
    Dim strKeys As String
    Dim Dict_BPName As New Scripting.Dictionary
    Dim Dict_Dates As New Scripting.Dictionary 'date dictionary
    Dim dateKey As String 'date keys
    
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    
    'Create a new BP list by looping through BPlist Sheet
    Set ws_Dest1 = s_BPSummary
    Set ws_Srce1 = s_BPList
    
    BRN = ws_Srce1.Range("E65536").End(xlUp).Row
    
    prdDate = ws_Srce1.Range("C65536").End(xlUp).Row
    insDate = ws_Srce1.Range("D65536").End(xlUp).Row
    
    ws_Dest1.Range("B4:B65536").ClearContents
    
    For i = 3 To BRN
        strKeys = ws_Srce1.Range("E" & i)
        If Not Dict_BPName.Exists(strKeys) Then
            Dict_BPName.Add strKeys, strKeys
        End If
    Next i
    
    'Unload Dictionary on Destination page
    For i = 0 To Dict_BPName.Count - 1
        ws_Dest1.Range("B" & i + 4) = Dict_BPName.Keys(i)
    Next i
    
    BRN = ws_Dest1.Range("B65536").End(xlUp).Row
    
    ws_Dest1.Range("B4:B" & BRN).Name = "BP_Names"
    
    
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    
End Sub

Any help is appreciated!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,605
Messages
6,179,860
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top