bonsoir Yvouille
les deux options fonctionnent après légères corrections.
Option Explicit
Public Drapeau_Match_4_à_8èmes As Boolean, Drapeau_Match_4_à_Quarts As Boolean, Drapeau_Match_4_à_Demies As Boolean
Public Drapeau_Déroulement_normal As Boolean
Sub Passer_aux_8èmes_de_finale()
Dim i As Integer, j As Byte, Feuille_de_base As String, Première_ligne As Byte, Dernière_ligne As Byte
With Sheets("Match 5")
Première_ligne = 19
Dernière_ligne = 20
If Première_ligne <> Dernière_ligne Then ' S'il y a vraiment des ex æquo
For i = Première_ligne To Dernière_ligne
.Range("P" & i) = Application.WorksheetFunction.RandBetween(1, 999999)
Next i
' ESSAI AVORTE 1 'manquait : dans la définition de la plage
.Range("M" & Première_ligne & ":P" & Dernière_ligne).Sort Key1:=.Range("P" & Première_ligne), Order1:=xlDescending, Header:=xlNo
' ESSAI AVORTE 2
' .Range("M" & Première_ligne & ":P" & Dernière_ligne).Select <- supprimer cette ligne pour que les instructions ci-dessous fonctionnent
' .Sort.SortFields.Clear
' .Sort.SortFields.Add2 Key:=.Range("P" & Première_ligne & ":P" & Dernière_ligne), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
' With .Sort
' .SetRange Range("M" & Première_ligne & ":P" & Dernière_ligne)
' .Apply
' End With
End If
End With
ActiveSheet.Protect , UserInterfaceOnly:=True
End Sub