Private Sub UserForm_Initialize()
Application.Goto [A1], -1
Me.Caption = "Classe " & [E1]
Groupe = Range("AB2:AB" & [AB65536].End(xlUp).Row)
For i = LBound(Groupe) To UBound(Groupe)
Gr = Groupe(i, 1): NomGroupe = Cells(i + 1, 27): j = 0
Controls("Frame" & i).Caption = StrConv(NomGroupe, 1)
If IsError(Application.Match(Gr, Columns(5), 0)) Then GoTo Suite
For l = 2 To [D65536].End(xlUp).Row
If Cells(l, 5) = Gr Then
ReDim Preserve Group(j)
Group(j) = Cells(l, 2)
j = j + 1
End If
Next
Controls("Frame" & i).Visible = True
For k = 0 To UBound(Group)
NumEl = i * 10 + k + 1
Set s = ActiveSheet.Shapes(Group(k))
s.CopyPicture
ActiveSheet.ChartObjects.Add(0, 0, s.Width, s.Height).Chart.Paste
ActiveSheet.ChartObjects(1).Chart.Export Filename:="monimage.jpg"
ActiveSheet.Shapes(ActiveSheet.Shapes.count).Delete
Controls("Image" & NumEl).PictureSizeMode = fmPictureSizeModeZoom
Controls("Image" & NumEl).Picture = LoadPicture("monimage.jpg")
Controls("Image" & NumEl).Visible = True
Kill "monimage.jpg"
Controls("Label" & NumEl).Caption = StrConv(Group(k), 3)
Controls("Label" & NumEl).Visible = True
ElRow = Application.Match(Group(k), Feuil3.Columns(1), 0)
m = Application.Match(NomGroupe, Columns(27), 0)
'Nb d'élève
Cells(m, 33) = Cells(m, 33) + 1
'Total de point
Cells(m, 29) = Cells(m, 29) + Feuil3.Cells(ElRow, 63)
Cells(m, 30) = Cells(m, 30) + Feuil3.Cells(ElRow, 64)
Cells(m, 31) = Cells(m, 31) + Feuil3.Cells(ElRow, 65)
Cells(m, 32) = Cells(m, 32) + Feuil3.Cells(ElRow, 66)
c = 1
For j = 2 To 42
If Feuil3.Cells(ElRow, j) <> "" Then
NumCB = i * 1000 + (k + 1) * 100 + c
With Me.Controls("CB" & NumCB)
.Visible = True
.Caption = Feuil3.Cells(5, j)
Select Case Feuil3.Cells(ElRow, j)
Case 1: .BackColor = &H80D700
Case 0.5: .BackColor = &H67FFFF
Case 0: .BackColor = &H7A78F5
End Select
c = c + 1
If c > 12 Then MsgBox "Il y a trop d'évaluations pour " & StrConv(Group(k), 3): GoTo EleveSuivant
End With
End If
Next j
EleveSuivant:
Next k
Suite:
Next i
End Sub