Il y a un onglet masqué qui reprend les données des feuilles commençant pas S
Option Base 1
Sub compiler()
Dim bdd As ListObject
Set bdd = Sheets("BdD").ListObjects(1)
If Not bdd.DataBodyRange Is Nothing Then bdd.DataBodyRange.Delete
lignes = Array(3, 6, 9, 12, 15)
With bdd
For Each f In Worksheets
If f.Name Like "S*" Then
For n = 1 To 5
.ListRows.Add
i = .ListRows.Count
With .DataBodyRange
.Cells(i, 1) = f.Cells(lignes(n), 1)
.Cells(i, 2) = f.Cells(lignes(n), 2)
.Cells(i, 6) = f.Cells(lignes(n) - 1, 4)
.Cells(i, 7) = f.Cells(lignes(n) - 1, 5)
End With
.ListRows.Add
i = .ListRows.Count
With .DataBodyRange
.Cells(i, 1) = f.Cells(lignes(n), 1)
.Cells(i, 2) = f.Cells(lignes(n), 2)
.Cells(i, 6) = f.Cells(lignes(n), 4)
.Cells(i, 7) = f.Cells(lignes(n), 5)
End With
Next
End If
Next
End With
Sheets("Recap").PivotTables(1).PivotCache.Refresh
End Sub
Quand tu actives la feuille Recap, cet onglet se met à jour en automatique
Private Sub Worksheet_Activate()
compiler
End Sub