Private Sub ComboBox1_Change()
Dim sDic As Object
Dim mNum As Integer, i As Long
j = 1
With Sheets("ACAD")
sA = .Range("A6:B" & .Cells(Rows.Count, "A").End(xlUp).Row).Value
End With
Set sDic = CreateObject("Scripting.Dictionary")
Set rDic = CreateObject("Scripting.Dictionary")
With ComboBox1
mNum = Application.Match(.Value, .List, 0)
For i = 1 To UBound(sA)
If Month(sA(i, 2)) = mNum Then
sDic(sA(i, 1)) = 1
rDic(sA(i, 2)) = 1
End If
Next
End With
If sDic.Count = 0 Then
ComboBox2.Clear
ComboBox2.AddItem "No Match Found"
Else
ComboBox2.List = sDic.Keys
ComboBox3.List = rDic.Keys
End If
Set sDic = Nothing
Set rDic = Nothing
End Sub
Private Sub ComboBox2_Change()
Dim sA, rDic As Object, mNum
Dim i As Long
With Sheets("ACAD")
sA = .Range("A6:B" & .Cells(Rows.Count, "A").End(xlUp).Row).Value
End With
If ComboBox2 = "" Then
Else
'' Use only if you need to match both Month and Week num to date.
' With ComboBox1
' mNum = Application.Match(.Value, .List, 0)
' End With
With ComboBox3
.Clear
For i = 1 To UBound(sA)
If CStr(sA(i, 1)) = ComboBox2.Value Then ' add condition if you want both week num and month to match "And Month(sA(i, 2)) = mNum"
.AddItem sA(i, 2)
End If
Next
End With
End If
End Sub
Private Sub ComboBox3_Change()
If ComboBox3 = "" Then
Else
ComboBox3.Value = Format(ComboBox3.Value, "DDD DD-MMM-YY")
End If
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List = Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")
End Sub