Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim P As Range, Q As Range, reflig As Range, i As Variant, refcol As Range, j As Variant
If Not IsNumeric(Sh.Name) Then Exit Sub
Application.ScreenUpdating = False
Sh.[C6].Resize(Sh.Rows.Count - 5, Sh.Columns.Count - 2).ClearContents 'RAZ
On Error Resume Next 'si aucune SpecialCell
Set P = Sh.Columns(2).SpecialCells(xlCellTypeConstants, 1)
Set Q = Sh.Rows(4).SpecialCells(xlCellTypeConstants, 2)
With Sheets("BASE")
For Each reflig In P
i = Application.Match(reflig, .Range("A4:A" & .Rows.Count), 0)
For Each refcol In Q
j = Application.Match(refcol, .Rows(2), 0)
If IsNumeric(i) And IsNumeric(j) Then Sh.Cells(reflig.Row, refcol.Column) = .Cells(i + 3, j)
Next refcol, reflig
End With
P.EntireRow.Sort Sh.Columns(3), xlAscending, Sh.Columns(2), , xlAscending, Header:=xlNo 'tri sur 2 colonnes
ActiveWindow.ScrollRow = 5 'cadrage
End Sub