After filtering on a column I end up with 4 rows instead of 105 but my code is still seeing 105 rows, how can i automatically refresh my pivot table as i appy a filter.I'll filter my sheet many times so i want my pivot table to adapt to my filtering (don't want to apply the filter directly on the pivot table but to automatize the procedure)
LastRow = alarmes.Cells(Rows.Count, 1).End(xlUp).Row
LastCol = 11
Set PRange = alarmes.Cells(1, 1).Resize(LastRow, LastCol)
Set PCache = Application.ThisWorkbook.PivotCaches.Create _
(SourceType:=xlDatabase, SourceData:=PRange)
Set PTable = PCache.CreatePivotTable _
(TableDestination:=graphe_dos.Cells(1, 1), TableName:="Test")