Sa m'intéresse, est-ce que vous pouvez me faire part de cette fonction svp?Il est aussi possible d'écrire une procédure qui n'utilise pas de formule (celles ci étant censées avoir été mises en place manuellement), mais qui utilise WorksheetFunction.Match …
Sub SansLesFormules()
Dim TDon(), TRés(), TSeuils(), L As Long
TDon = [C4:E13].Value
ReDim TRés(1 To UBound(TDon, 1), 1 To 2)
TSeuils = Array(0, 10, 12, 16)
For L = 1 To UBound(TDon, 1)
If TDon(L, 1) = "Licence" Then
TRés(L, 1) = 0.25 * TDon(L, 2) + 0.75 * TDon(L, 3)
Else
TRés(L, 1) = 0.35 * TDon(L, 2) + 0.65 * TDon(L, 3)
End If
TRés(L, 2) = Choose(WorksheetFunction.Match(TRés(L, 1), TSeuils), "Ajourné", "Assez Bien", "Bien", "Très Bien")
Next L
Feuil1.[H4:I13].Value = TRés
End Sub
Honnêtement j'ai commencé à comprendre et je vous remercie infiniment. Je vais continuer à m'exercer pour bien comprendre.Oh et puis après tout c'est votre problème …
Ce serait juste sympa de me dire honnêtement ce que vous en aurez tiré comme bénéfice …VB:Sub SansLesFormules() Dim TDon(), TRés(), TSeuils(), L As Long TDon = [C4:E13].Value ReDim TRés(1 To UBound(TDon, 1), 1 To 2) TSeuils = Array(0, 10, 12, 16) For L = 1 To UBound(TDon, 1) If TDon(L, 1) = "Licence" Then TRés(L, 1) = 0.25 * TDon(L, 2) + 0.75 * TDon(L, 3) Else TRés(L, 1) = 0.35 * TDon(L, 2) + 0.65 * TDon(L, 3) End If TRés(L, 2) = Choose(WorksheetFunction.Match(TRés(L, 1), TSeuils), "Ajourné", "Assez Bien", "Bien", "Très Bien") Next L Feuil1.[H4:I13].Value = TRés End Sub
Option Explicit
Public Sub CalculNoteFinaleetMention()
Dim Myarray As Variant
Dim IndexMyarray As Integer
Myarray = Mysheet.Range("C4").Resize(10, 3).Value
For IndexMyarray = 1 To UBound(Myarray)
Select Case Myarray(IndexMyarray, 1)
Case "Licence"
Mysheet.Cells(3 + IndexMyarray, 8) = (Myarray(IndexMyarray, 2) * 0.25) + (Myarray(IndexMyarray, 3) * 0.75)
Case "Master"
Mysheet.Cells(3 + IndexMyarray, 8) = (Myarray(IndexMyarray, 2) * 0.35) + (Myarray(IndexMyarray, 3) * 0.65)
End Select
Select Case Mysheet.Cells(3 + IndexMyarray, 8)
Case 0, Is < 10
Mysheet.Cells(3 + IndexMyarray, 9) = Mysheet.Range("N15")
Case 10, Is < 12
Mysheet.Cells(3 + IndexMyarray, 9) = Mysheet.Range("N16")
Case 12, Is < 16
Mysheet.Cells(3 + IndexMyarray, 9) = Mysheet.Range("N17")
Case 16, Is < 20
Mysheet.Cells(3 + IndexMyarray, 9) = Mysheet.Range("N18")
End Select
Next IndexMyarray
End Sub