Option Explicit
Private TMoy()
Private Sub UserForm_Initialize()
Me.ComboBox1.List = Array("Langue", "EPS", "Maths", "Sciences", "Histoire")
TMoy = Array(10, 5, 10, 10, 5)
End Sub
Private Sub CommandButton1_Click()
' tenir compte de la valeur choisie en Combobox1
' la moyenne est 5 pour "EPS" et "Histoire" mais 10 pour "Langue", "Maths" et "Sciences"
Dim Moy As String
If Not ComboBox1.MatchFound Then Exit Sub
Moy = TMoy(ComboBox1.ListIndex)
If OptionButton1.Value Then
Range("A1").Value = "<" & Moy
End If
If OptionButton2.Value Then
Range("A1") = ">=" & Moy
End If
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Range("A1").Select
Selection.ClearContents
End Sub