Hi there,
I have recently been getting back into VBA, and I have come across something I am unable to spot where I have gone wrong.
I have set up a report using a pivot table and I have trying to sort out in specific date range. for example in need to show information that is 0-1 day old, 1-3, 3-5 and so on. The code I'm using is
Dim todayDate As Date
Dim yesterday As Date
todayDate = Format(Now, "dd, mm, yyyy")
yesterday = Format(Now - 1, "dd, mm, yyyy")
Sheets("Dates").Select
ActiveSheet.PivotTables("Dates").PivotFields("Reported Date+").PivotFilter.Add Type:=xlDateBetween, Value1:=yesterday, Value2:=todayDate
Can anyone help me out on this one?