Bonjour,
j'ai un exo qui me pose probleme
On me demande:
Exercice 1
Soient 5 notes enregistrées au sein des cellules de la plage B1:B5.
1. Ecrire la procédure qui calcule la mention correspondante à chaque note et les affecte à la plage C1:C5, et qui calcule leur moyenne et l’affecte à la cellule B6.
Voila ce que j'ai fais :
Sub cell()
Dim i As Integer
Dim somme As Integer
For ligne = 1 To 5
If cells(ligne, 2) < 10 Then
cells(ligne, 3) = "passable"
ElseIf cells(ligne, 2) >= 10 And cells(ligne, 2) < 12 Then
cells(ligne, 3) = "Cool"
ElseIf cells(ligne, 2) >= 12 And cells(ligne, 2) < 14 Then
cells(ligne, 3) = "assez bien"
ElseIf cells(ligne, 2) >= 14 And cells(ligne, 2) < 16 Then
cells(ligne, 3) = " bien"
ElseIf cells(ligne, 2) >= 16 And cells(ligne, 2) <= 20 Then
cells(ligne, 3) = "bravooo!!!"
somme = somme + cells(ligne, 2)
Next
cells(6, 2) = somme / 5
End Sub
mais ils m'écrivent " Next sans for " ? pourquoi?
j'ai un exo qui me pose probleme
On me demande:
Exercice 1
Soient 5 notes enregistrées au sein des cellules de la plage B1:B5.
1. Ecrire la procédure qui calcule la mention correspondante à chaque note et les affecte à la plage C1:C5, et qui calcule leur moyenne et l’affecte à la cellule B6.
Voila ce que j'ai fais :
Sub cell()
Dim i As Integer
Dim somme As Integer
For ligne = 1 To 5
If cells(ligne, 2) < 10 Then
cells(ligne, 3) = "passable"
ElseIf cells(ligne, 2) >= 10 And cells(ligne, 2) < 12 Then
cells(ligne, 3) = "Cool"
ElseIf cells(ligne, 2) >= 12 And cells(ligne, 2) < 14 Then
cells(ligne, 3) = "assez bien"
ElseIf cells(ligne, 2) >= 14 And cells(ligne, 2) < 16 Then
cells(ligne, 3) = " bien"
ElseIf cells(ligne, 2) >= 16 And cells(ligne, 2) <= 20 Then
cells(ligne, 3) = "bravooo!!!"
somme = somme + cells(ligne, 2)
Next
cells(6, 2) = somme / 5
End Sub
mais ils m'écrivent " Next sans for " ? pourquoi?