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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| Sub barrePE()
nbCellsJalPE
moyennePE
Dim a, b, c, d, i, j(12) As Integer
a = -1
d = -1
For c = 0 To 12
DeleteShape (c + 100)
DeleteShape (c + 200)
j(c) = 0
Next c
For i = 0 To Cells(89, 1).Value - 1
If Cells(82, 12 + i).Value <> "" Then
a = a + 1
j(a) = Cells(80, 12 + i).Value 'recupères des valeur pour séparer les différentes barres d'avancement
End If
Next i
For b = 0 To Cells(89, 1).Value - 1
d = -1
Dim CoordX, CoordY As Double
Dim hauteur, Hauteur1, largeur As Double
Dim CoordX1, CoordY1 As Double
Dim Hauteur2 As Double
Hauteur1 = 0
If j(b) = 0 Then
Else
CoordX = Cells(23, j(b) + 8 - nbCellsJalonPE(j(b) - 1)).Left
CoordY = Cells(23, j(b) + 8 - nbCellsJalonPE(j(b) - 1)).Top
For i = 0 To nbCellsJalonPE(j(b) - 1) - 1
d = d + 1
Hauteur1 = Hauteur1 + Cells(23, 8 + j(b) - nbCellsJalonPE(j(b) - 1) + d).width
Next i
hauteur = (Hauteur1 * moyPE(j(b) - 1))
largeur = Cells(23, 8 + b).RowHeight
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, CoordX, CoordY, hauteur, largeur) 'crée un rectangle de taille variable
.Name = "fait" & j(b) + 100
.DrawingObject.Interior.ColorIndex = 43
End With
CoordX1 = Cells(23, j(b) + 8 - nbCellsJalonPE(j(b) - 1)).Left + hauteur
CoordY1 = Cells(23, j(b) + 8 - nbCellsJalonPE(j(b) - 1)).Top
Hauteur2 = Hauteur1 - (hauteur)
With ActiveSheet.Shapes.AddShape(msoShapeRectangle, CoordX1, CoordY1, Hauteur2, largeur) 'crée un rectangle de taille variable
.Name = "fait" & j(b) + 200
.DrawingObject.Interior.ColorIndex = 3
End With
End If
Next b
End Sub |
Partager