Here's the complete VBA code:
Option Explicit
Sub showCurrentMonthData()
Sheet1.Range("A1:C15").AutoFilter field:=3, Criteria1:=xlFilterThisMonth, Operator:=xlFilterDynamic
End Sub
Sub showAllData()
On Error Resume Next
ActiveSheet.showAllData
Range("A1").AutoFilter
End Sub
Sub showCurrentYearData()
Sheet1.Range("A1:C15").AutoFilter field:=3, Criteria1:=xlFilterThisYear, Operator:=xlFilterDynamic
End Sub
Sub showLastYearData()
Sheet1.Range("A1:C15").AutoFilter field:=3, Criteria1:=xlFilterLastYear, Operator:=xlFilterDynamic
End Sub
Sub showLastMonthData()
Sheet1.Range("A1:C15").AutoFilter field:=3, Criteria1:=xlFilterLastMonth, Operator:=xlFilterDynamic
End Sub
0 Comments