Sub Worksheet_Activate()
MAJ
End Sub
Sub MAJ()
Application.ScreenUpdating = False
IndexW = 5
Sheets("Présence - 18").Range("D5:G34").ClearContents
If Not IsError(Application.Match(Sheets("Présence - 18").[F1], Sheets("Base de données - 18").[1:1], 0)) Then
IndexR = Application.Match(Sheets("Présence - 18").[F1], Sheets("Base de données - 18").[1:1], 0)
Set Ws = Sheets("Base de données - 18")
For Ligne = 2 To Ws.Range("C65500").End(xlUp).Row
With Sheets("Présence - 18")
If Ws.Cells(Ligne, IndexR) = "A l'heure" Or _
Ws.Cells(Ligne, IndexR) = "Retard" Then
.Cells(IndexW, 4) = Ws.Cells(Ligne, 13)
.Cells(IndexW, 5) = Ws.Cells(Ligne, 2)
.Cells(IndexW, 6) = Ws.Cells(Ligne, 3)
.Cells(IndexW, 7) = Ws.Cells(Ligne, 16)
IndexW = IndexW + 1
End If
End With
Next Ligne
End If
End Sub