Invisibleman
New Member
- Joined
- Sep 16, 2015
- Messages
- 13
Dear all,
I try to set the date filter on the Pivot thru VBA. But if I do try with the date, this is generating an error, where I don't know why/how to solve.
I have extra set the cell value to a date in the code, but this also doesn't help.
My code is;
And the error I am getting is;
But to be honest, when searching the web, I don't see what I am doing wrong.
I also did try, for testing, to only filter on the xlafter, so disable the xlCaptionContains, but still I am receiving the error.
If you can help, that would be very appriciated,
Regards,
Hans
I try to set the date filter on the Pivot thru VBA. But if I do try with the date, this is generating an error, where I don't know why/how to solve.
I have extra set the cell value to a date in the code, but this also doesn't help.
My code is;
VBA Code:
Private Sub box47_6_SelectCrypto_Change()
Dim startdate As Date
startdate = New_Chart_DailyCrypto.Range("K1").Value
With New_Pivot_DailyExchange.PivotTables("Pivottable1").PivotFields("Crypto")
.ClearAllFilters
.PivotFilters.Add Type:=xlCaptionContains, Value1:=box47_6_SelectCrypto.Value
.PivotFilters.Add Type:=xlAfter, Value1:=startdate
End With
End Sub
And the error I am getting is;
But to be honest, when searching the web, I don't see what I am doing wrong.
I also did try, for testing, to only filter on the xlafter, so disable the xlCaptionContains, but still I am receiving the error.
If you can help, that would be very appriciated,
Regards,
Hans