Private Sub Worksheet_Change(ByVal Target As Range)
Dim x, y, P As Range, ncol%, tablo, i&, t$, j%
x = [C6]: y = [C16]
If x = "" Or y = "" Or Intersect(Target, [C6,C16]) Is Nothing Then Exit Sub
Set P = Sheets("BdD").UsedRange
ncol = P.Columns.Count
tablo = P.Resize(P.Rows.Count + 1, IIf(ncol < 6, 6, ncol)) 'matrice, plus rapide
For i = 2 To UBound(tablo)
If tablo(i, 2) & tablo(i, 6) = x & y Then _
MsgBox "Attention le nom que vous avez saisi et la durée sont déjà dans la BdD !", vbCritical: Exit Sub
Next
For i = 2 To UBound(tablo)
If tablo(i, 2) = "" Then
t = ""
For j = 3 To ncol
t = t & tablo(i, j)
Next
If t = "" Then P(i, 2) = x: P(i, 6) = y: Exit Sub
End If
Next
End Sub