Bonsoir Potpot,
, les dates
voici le code pour ta demande... non-testé car pour une raison que j'ignore, à un moment, les cellules-dates dans CALENDRIER affichent une erreur!
Bref, c'est toi qui va essuyer les plâtres!
A coller dans 'FICHE DE PRESENCE'
Private Sub Worksheet_Change(ByVal Target As Range)
'
Dim sh1 As Worksheet
'
Set sh1 = Worksheets("Calendrier")
Set sh2 = Worksheets("TABLE")
'
If Not Application.Intersect(Target, Range("A11")) Is Nothing Then
For x = 1 To 12
If [A11] = sh2.Cells(3 + x, 7) Then Cells(1, Columns.Count) = x
Next
End If
'
If Not Application.Intersect(Target, Range("E1")) Is Nothing Then
sFlag = [E1]
iFlag = Cells(1, Columns.Count)
Application.ScreenUpdating = False
Application.EnableEvents = False
With sh1
iRow = 1
iLig = 19
For x = 1 To 6
For y = iRow To iRow+50
If IsDate(.Cells(y, 2)) Is True Then
For Z = 2 To 8
If Month(.Cells(y, Z)) = iFlag Then
For k = y + 1 To y+50
If .Cells(k, Z) = "" Or IsDate(.Cells(k, Z)) = True Then Exit For
If .Cells(k, Z) = sFlag Then
iLig = iLig + 2
Cells(iLig, 2) = .Cells(y, Z)
Exit For
End If
Next
End If
Next
End If
Next
Next
End With
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
'
End Sub
Croisons les doigts!
A+