Option Compare Text
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Application.EnableEvents = False
Rows("14:100").Delete
[A13].ClearContents
[A1].Select
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim Lig As Integer, DerLig As Integer, Crs As String
If Target.Count > 1 Then Exit Sub
If Target.Address = "$A$13" And Target <> "" Then
Rows("14:100").Delete
Crs = "Course n°" & Format(Val(Right(Target, 2)) + 2, "00")
With Sheets("Feuil1")
Lig = Application.Match(Target, .Range("A1:A" & .[A65000].End(xlUp).Row), 0) + 2
On Error Resume Next
DerLig = Application.Match(Crs, .Range("A1:A" & .[A65000].End(xlUp).Row), 0) - 2
If DerLig = 0 Then DerLig = .[A65000].End(xlUp).Row
On Error GoTo 0
.Range(.Cells(Lig, 1), .Cells(DerLig, 10)).Copy [B15]
End With
End If
With Cells
.VerticalAlignment = xlVAlignCenter
.WrapText = False
.Columns.AutoFit
End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Dim Cel As Range
If Target.Count > 1 Then Exit Sub
If Target.Address = "$A$13" Then
With Sheets("Feuil1")
For Each Cel In .Range("A10:A" & .[A65000].End(xlUp).Row)
If Left(Cel.Value, 6) = "course" Then list_course = list_course & Cel.Value & ","
Next Cel
End With
With Target.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Left(list_course, Len(list_course) - 1)
End With
End If
End Sub