Filter Data for Current Month or Year @Exceltrainingvideos
Filter Data for Current Month or Year  @Exceltrainingvideos
Uploaded December 2019 | Updated September 2026, 1 week ago
How to automate filtering of data for current month, current year, last month or last year using VBA.
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
Filter Data for Current Month or YearCreate Multiple Copies of Master Sheet AutomaticallyA Super Simple Inventory Automation SystemAnalyze Data Using DGET FunctionPower BI Desktop Data Analysis VisualizationsHow to Open Most Recent File from Specific FolderDump Web Page Data into Worksheet | 2021Automate Slicer Creation Using Table Data2021 | Forgot Excel Password | How to Remove a Password from Excel | 100% SuccessUpdate Master Sheet with a ClickCreate Searchbox Using Filter Function AutomaticallyUser-form to Manage Data Automatically
Dinesh Kumar Takyar |

Filter Data for Current Month or Year

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER