I have previously used the following code to filter a pivot table by date range:
It worked fine yesterday but today in another workbook I get a data type mismatch error of the line:
Any Ideas?
Code:
For Each PivItem In PivTable.PivotFields("Date").PivotItems
If PivItem.Value < DateFrom Or PivItem.Value > DateTo Then
If PivItem.Visible = True Then
PivItem.Visible = False
End If
End If
Next PivItem
It worked fine yesterday but today in another workbook I get a data type mismatch error of the line:
Code:
If PivItem.Visible = True Then
Any Ideas?