Rolly_Sefu
Board Regular
- Joined
- Oct 25, 2013
- Messages
- 149
Hello
I have created a userform that allows users to filter a worksheet.
But I can not get the filter to work for the month and for the blanks
I have this so far:
Filter month (combobox2 = month name)
And the blanks
The problem is that I don't know how to combine the 3 criteria's.
Any ideas ?
Thanks.
I have created a userform that allows users to filter a worksheet.
But I can not get the filter to work for the month and for the blanks
I have this so far:
Filter month (combobox2 = month name)
Code:
Dim startDate As Long
Dim endDate As Long
startDate = DateSerial(Year(Date), Month(DateValue(ComboBox2.Value & " 1")), 1)
endDate = WorksheetFunction.EoMonth(startDate, 0)
ActiveSheet.Range("A7", Range("A" & Rows.Count).End(xlUp)).AutoFilter Field:=2, Criteria1:=">=" & startDate, Criteria2:="<=" & endDate
And the blanks
Code:
ActiveSheet.Range("A7", Range("A" & Rows.Count).End(xlUp)).AutoFilter Field:=4, Criteria1:=ComboBox2.Value, Operator:=xlOr, Criteria2:="="
The problem is that I don't know how to combine the 3 criteria's.
Any ideas ?
Thanks.