Try this for finding the column for the selected date.
Colonne_index = Application.Match(CLng(Calendrier.Value), range_lookup, 0)+3
After you've found the column use this to find the next empty row.
empty_row = Sheets("Insc").Cells(Rows.Count, Colonne_Index).End(xlUp).Row+1
Now you can put the name in.
Sheets("Insc").Cells(empty_row, Colonne_index).Value = Nom.Value
You'll also need to add checks for the date being found and that there is a space for the player if the date is found.
So the code would look like this.
Private Sub OK_Click()
Dim range_lookup As Range
Dim emptyRow As Long
Dim Colonne_Index As Long
Set range_lookup = Sheets("Insc").Range("D3:AZ3")
Colonne_Index = Application.Match(CLng(Calendrier.Value), range_lookup, 0) + 3
If Not IsError(Colonne_Index) Then
empty_row = Sheets("Insc").Cells(Rows.Count, Colonne_Index).End(xlUp).Row + 1
If empty_row < 10 Then
Sheets("Insc").Cells(empty_row, Colonne_Index).Value = Nom.Value
End If
End If
End Sub
Bookmarks