fishandtril
New Member
- Joined
- Nov 15, 2022
- Messages
- 13
- Office Version
- 365
- 2021
- Platform
- Windows
I am using the below code to toggle on and off filter showing current month.
The code works with the exception it leaves the sheet without filters. I would like thist to leave AutoFilterMode=True once run.
The code works with the exception it leaves the sheet without filters. I would like thist to leave AutoFilterMode=True once run.
VBA Code:
Sub Toggle_Current_Month()
'
' Macro to filter current month basis BOL Date
'
With ActiveSheet
If .AutoFilterMode Then
.AutoFilterMode = False
Else
ActiveSheet.Range("$A$96:$CM$1500").AutoFilter Field:=16, Criteria1:=xlFilterThisMonth, Operator:=xlFilterDynamic
End If
End With
End Sub
Last edited by a moderator: