XL 2010 Excel Vba

Konte94

XLDnaute Junior
Salut, svp qui peut m'aider à faire ce t'exercice je l'ai essayé mais j'ai rencontré quelques difficultés.
 

Pièces jointes

  • Exercice 2.xlsm
    12.8 KB · Affichages: 15

Dranreb

XLDnaute Barbatruc
Oh et puis après tout c'est votre problème …
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
Ce serait juste sympa de me dire honnêtement ce que vous en aurez tiré comme bénéfice …
 

Konte94

XLDnaute Junior
Oh et puis après tout c'est votre problème …
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
Ce serait juste sympa de me dire honnêtement ce que vous en aurez tiré comme bénéfice …
Honnêtement j'ai commencé à comprendre et je vous remercie infiniment. Je vais continuer à m'exercer pour bien comprendre.
 

NXP

XLDnaute Nouveau
Voici ma solution
VB:
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



End Sub
 

Discussions similaires

Membres actuellement en ligne

Statistiques des forums

Discussions
312 370
Messages
2 087 693
Membres
103 641
dernier inscrit
anouarkecita2