Hi all,
I am currently using the code below to filter a sheet based on 2 criteria:
1. Whether a product is ordered
2. Whether this order occurs next quarter (e.g. Q3 2011).
I would like to automate the next quarter filter, so that the macro simply knows that, if we're in q3 2011, to filter for q4 2011 results or if we're in q4 2011, to filter for q1 2012 results etc.
Quarters are:
Jan - march
April - June
July - Sep
Oct - dec
I have the individual dates of all the order occurences stored on the same sheet.
Thanks ,
Fred
I am currently using the code below to filter a sheet based on 2 criteria:
1. Whether a product is ordered
2. Whether this order occurs next quarter (e.g. Q3 2011).
I would like to automate the next quarter filter, so that the macro simply knows that, if we're in q3 2011, to filter for q4 2011 results or if we're in q4 2011, to filter for q1 2012 results etc.
Quarters are:
Jan - march
April - June
July - Sep
Oct - dec
I have the individual dates of all the order occurences stored on the same sheet.
Thanks ,
Fred
Code:
Sub Filter_CPIPCatManQ3()
'
' Filter_Q1 Macro
'
Sheets("Sheet 1").Select
Range("A1").Select
ActiveSheet.Protect Password:="Password", DrawingObjects:=True, _
contents:=True, Scenarios:=True, _
userinterfaceonly:=True
ActiveSheet.EnableAutoFilter = True
If ActiveSheet.AutoFilterMode Then
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
End If
ActiveSheet.Range("$D$12:$AE$118").AutoFilter Field:=3, Criteria1:= _
"Tiles Ordered"
ActiveSheet.Range("$D$12:$AE$118").AutoFilter Field:=10, Criteria1:= _
"Q3 2011"
End Sub