Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim DL%, L%, i%, Nom$, Prenom$, Groupe$, Tablo
Application.ScreenUpdating = False
With Sheets("données élèves")
DL = .Cells(.Cells.Rows.Count, "A").End(xlUp).Row ' Dernière ligne du tableau des élèves
Tablo = .Range("A2:G" & DL) ' Recup tableau élèves dans un array
End With
If Left([A1], 5) <> "Année" Then Exit Sub ' On sort si en A1 on n'a pas "Année"
Groupe = [D3] ' Recup du groupe de la feuille
Cells.EntireRow.Hidden = False ' On démasque toutes les lignes
DL = Cells(Cells.Rows.Count, "A").End(xlUp).Row ' Dernière ligne utilisée
For L = 6 To DL ' Pour toutes les lignes
Nom = Cells(L, "A"): Prenom = Cells(L, "B") ' On récupère Nom et Prenom
For i = 1 To UBound(Tablo) ' On balaie toute la liste des élèves
If Tablo(i, 5) = Groupe Then ' Si c'est le bon groupe
If Tablo(i, 7) <> "" Then ' et qu'il y a une date de sortie
If Tablo(i, 2) = Nom And Tablo(i, 3) = Prenom Then ' et si c'est le bon élève
Rows(L).EntireRow.Hidden = True ' Alors on ùmasque la ligne
End If
End If
End If
Next i
Next L
End Sub