1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Set FO = ThisWorkbook.Sheets("FRANCAIS") 'Feuilles d'où les données vont être extraites
Set FO2 = ThisWorkbook.Sheets("MATHS")
Set FD = ThisWorkbook.Sheets("PAR_SECTEURS") 'Feuille de destination
LastLigne = FD.Cells(Rows.Count, "M").End(xlUp).Row 'Récupére le nombre de lignes de la colonne du premier secteur.
DerLigne = FO.Cells(Rows.Count, "J").End(xlUp).Row 'Récupére le nombre de lignes de la colonne RNE sur la feuille "Analyse ECOLES"
'DerLigne2 = FO.Cells(Rows.Count, "J").End(xlUp).Row
'Récupération des données de français pour les écoles du secteur
j = 28
For Ligne = 2 To LastLigne
i = 78
While i < DerLigne + 1
If FD.Cells(Ligne, "M").Value = FO.Cells(i, "J").Value Then
With FO
FO.Range("K" & i & ":AN" & i).Copy Destination:=FD.Range("J" & j)
End With
i = i + 1
i = DerLigne + 1
Else
i = i + 1
End If
Wend
j = j + 1
Next Ligne
'Calcul des sommes et pourcentages d'élèves à besoin et récupération dans le tableau
Dim A As Single
For col = 10 To 41
Cells(101, col) = Application.WorksheetFunction.Sum(Range(Cells(28, col), Cells(100, col)))
Cells(101, col + 1) = Application.WorksheetFunction.Sum(Range(Cells(28, col + 1), Cells(100, col + 1)))
Cells(101, col + 2) = Application.WorksheetFunction.Sum(Range(Cells(28, col + 2), Cells(100, col + 2)))
A = Cells(102, col) / Application.WorksheetFunction.Sum(Range(Cells(101, col), Cells(101, col + 2))) * 100
col = col + 2
Next col |
Partager