Advertisement
veronikaaa86

Event

Jan 13th, 2022
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1.  
  2.  
  3. Private Sub Below3_Click()
  4.  
  5. End Sub
  6.  
  7. Private Sub cb1_Click()
  8. Dim lastRow As Integer
  9. lastRow = Cells(Rows.count, 1).End(xlUp).Row
  10.  
  11. Sheets.Add(Before:=Sheets("Sheet0")).Name = "Protocol"
  12. CopyData
  13. InsertColumns
  14. FormatHeaders (lastRow)
  15.  
  16. PracticalAndThereticalPoints (lastRow)
  17. Dim percentPractical, percentTheoretical As Integer
  18. percentPractical = practicalExamTB.value
  19. percentTheoretical = theoreticalExamTB.value
  20. CoursePoints lastRow, percentPractical, percentTheoretical
  21.  
  22. Dim pointsFor5, pointsFor3 As Integer
  23. pointsFor5 = pointsFor5TB.value
  24. pointsFor3 = pointsFor3TB.value
  25. Grade lastRow, pointsFor5, pointsFor3
  26.  
  27. Range("G2") = "=SUM(C2:C" & lastRow & ")"
  28. Range("H2") = "=COUNTA(C2:C" & lastRow & ")"
  29. Range("I2") = Range("G2").value / Range("H2").value
  30.  
  31. Range("I3") = Range("H2") / lastRow * 100
  32.  
  33. Range("H4") = GetPoorGrade(lastRow)
  34. Range("H5") = GetExcelentGrade(lastRow)
  35.  
  36. Range("I4") = Range("H4") / Range("H2") * 100
  37. Range("I5") = Range("H5") / Range("H2") * 100
  38.  
  39. CourseP.Caption = lastRow - 1
  40. Miss.Caption = Range("I3").value
  41. GPA.Caption = Range("I2").value
  42. Below3.Caption = Range("I4").value
  43. Above5.Caption = Range("I5").value
  44.  
  45. End Sub
  46.  
  47. Function GetPoorGrade(lastRow As Integer)
  48. Dim countPoor As Integer
  49. For i = 1 To lastRow
  50. If Range("C" & i) <= 3 And Range("C" & i) <> "" Then
  51. countPoor = countPoor + 1
  52. End If
  53. Next
  54. GetPoorGrade = countPoor
  55. End Function
  56.  
  57. Function GetExcelentGrade(lastRow As Integer)
  58. Dim count As Integer
  59. For i = 1 To lastRow
  60. If Range("C" & i) >= 5 Then
  61. count = count + 1
  62. End If
  63. Next
  64. GetExcelentGrade = count
  65. End Function
  66.  
  67.  
  68.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement