primasatria
New Member
- Joined
- Dec 3, 2023
- Messages
- 11
- Office Version
- 365
- 2021
- Platform
- Windows
Dear all,
I am using MS Office 365, I need to filter based on multiple criteria and based on date based on cell value in cell K1.
The problem, I tried by to run this code below, but somehow I can not filtered date in column K, while others can be filtered as I wanted.
Is there anybody could helping me? I've been stuck with this code for 3 days already.
Thank you so much, for your helping hand.
Best regards,
Prima - Indonesia
I am using MS Office 365, I need to filter based on multiple criteria and based on date based on cell value in cell K1.
The problem, I tried by to run this code below, but somehow I can not filtered date in column K, while others can be filtered as I wanted.
VBA Code:
Sub Filter_DailyReport()
Dim fdate As Long
Range("AK1").FormulaR1C1 = "=TODAY()-1"
Range("AK1").Value = Range("AK1").Value
'Range("AK1").NumberFormat = "[$-en-US]dd-mmm-yy;@"
fdate = Range("AK1").Value
Set ws = ThisWorkbook.Sheets("Database")
ws.ListObjects("Table1").Range.AutoFilter Field:=28, Criteria1:="Approved"
ws.ListObjects("Table1").Range.AutoFilter Field:=30, Criteria1:="Red"
ws.ListObjects("Table1").Range.AutoFilter Field:=37, Criteria1:=fdate
ws.ListObjects("Table1").Range.AutoFilter Field:=38, Criteria1:="FE Const."
ws.ListObjects("Table1").Range.AutoFilter Field:=41, Criteria1:="JPK Utara"
' Define the range to apply the filter to
'Set rng = ws.Range("G2:G" & ws.Cells(ws.Rows.Count, "G").End(xlUp).Row)
' Clear any existing filters
'ws.AutoFilterMode = False
End Sub
Is there anybody could helping me? I've been stuck with this code for 3 days already.
Thank you so much, for your helping hand.
Best regards,
Prima - Indonesia