Hello everyone
I have a dynamic table in which I have the day filter which comes from the =DAY() function and I want to be able to filter it from visual for days less than or equal to the present day.
I can filter the information but I get error 13 type mismatch
Sub TablaZona2()
Dim pvtItm1 As PivotItem
Dim fecha As Integer
Dim PTable1 As PivotTable
Set PTable1 = ActiveSheet.PivotTables("TablaZona1")
fecha = Day(Now)
For Each pvtItm1 In PTable1.PivotFields("DIA").PivotItems
If pvtItm1.Value < fecha Then
pvtItm1.Visible = True
Else
pvtItm1.Visible = False
End If
Next
End Sub
Could you help me, thank you
I have a dynamic table in which I have the day filter which comes from the =DAY() function and I want to be able to filter it from visual for days less than or equal to the present day.
I can filter the information but I get error 13 type mismatch
Sub TablaZona2()
Dim pvtItm1 As PivotItem
Dim fecha As Integer
Dim PTable1 As PivotTable
Set PTable1 = ActiveSheet.PivotTables("TablaZona1")
fecha = Day(Now)
For Each pvtItm1 In PTable1.PivotFields("DIA").PivotItems
If pvtItm1.Value < fecha Then
pvtItm1.Visible = True
Else
pvtItm1.Visible = False
End If
Next
End Sub
Could you help me, thank you