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 )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?
This is my code so far, no attempts to do any of the above yet though
Any help is appreciated!
1. search substring (sorry, don't know VBA equivalent )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?
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!