Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'la macro s'exécute chaque fois qu'une feuille est activée
Dim n%, F As Worksheet, total As Range, cel As Range, lig%
'---contrôles---
If Not IsNumeric(Sh.Name) Then Exit Sub
n = Sh.Name
On Error Resume Next
Set F = Sheets("RECETTES 2012")
If Err Then MsgBox _
"La feuille 'RECETTES 2012' n'existe pas !", 48: Exit Sub
Set total = Sh.[C:C].Find("TOTAL", , xlFormulas, xlPart)
If total Is Nothing Then MsgBox _
"""TOTAL"" n'existe pas en colonne C !", 48: Exit Sub
If total.Row - 2 < Application.CountIf(F.[F:F], n) Then _
MsgBox "La hauteur du tableau est insuffisante !", 48: Exit Sub
'---effacement---
Application.ScreenUpdating = False
Sh.Rows("2:" & total.Row - 1).ClearContents
'---remplissage---
For Each cel In F.[F:F].SpecialCells(xlCellTypeConstants, 1)
If Err Then Exit Sub 'si pas de valeurs numériques
lig = Sh.Cells.Find("*", total, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
If cel = n Then
Sh.Cells(lig, 1).Resize(, 5) = F.Cells(cel.Row, 1).Resize(, 5).Value
Sh.Cells(lig, 6) = F.Cells(cel.Row, 7)
End If
Next
End Sub