Курсовая работа: Успеваемость студентов
Value = Worksheets("Storage").Cells(j, 1).Value
If Len(Value) > 0 Then
If Worksheets("Storage").Cells(j, 2).Value + " " + Worksheets("Storage").Cells(j, 3).Value + " " + Worksheets("Storage").Cells(j, 4).Value = Student.Value Then Exit Do
End If
j = j + 1
Loop Until Len(Value) = 0
For i = 0 To 8
If Split(Worksheets("Storage").Cells(j, i + 5).Value, ":")(Index) = "5" Then Stat(0) = Stat(0) + 1
If Split(Worksheets("Storage").Cells(j, i + 5).Value, ":")(Index) = "4" Then Stat(1) = Stat(1) + 1
If Split(Worksheets("Storage").Cells(j, i + 5).Value, ":")(Index) = "3" Then Stat(2) = Stat(2) + 1
If Split(Worksheets("Storage").Cells(j, i + 5).Value, ":")(Index) = "2" Then Stat(3) = Stat(3) + 1
Next i
.Cells(1, 1).Value = "Диаграмма успеваемости студента: "
.Cells(2, 1).Value = Student.Value
.Cells(3, 1).Value = Str(Index + 1) + "-й семестр"
For i = 0 To 3
.Cells(i + 4, 1).Value = "Оценка " + Str(5 - i)
.Cells(i + 4, 2).Value = Str(Stat(i))
Next i
Set ChartObj = .ChartObjects.Add(0, 0, 400, 400)
ChartObj.Chart.ChartType = xlPie
ChartObj.Chart.SeriesCollection.Add Source:=Range(.Cells(4, 2), .Cells(7, 2))
ChartObj.Chart.SeriesCollection.Item(1).XValues = Range(.Cells(4, 1), .Cells(7, 1))
ChartObj.Chart.HasLegend = True
ChartObj.Chart.Legend.Position = xlBottom
ChartObj.Chart.HasTitle = True
ChartObj.Chart.ChartTitle.Text = "Диаграмма успеваемости студента" + Chr(10) + Student.Value + Chr(10) + Str(Index + 1) + "-й семестр"
End With
End Sub