Bonjour,
Je desire realiser un diagramme de gantt et j'ai trouve un code "tout fait " sur internet.Le problem c'est que je ne dois pas mettre le bon argument pour lancer le code.A mon avis c'est tout bete, mais je ne comprend pa.
Merci.
Le code suivant cree un Gantt Chart a partir d'un tableau excel de la forme:
;Start Date; progress; Due Date
phase 1; 01/01/2004; 150; 360;
phase 2; 01/01/2005; 150; 360;
phase 3; 01/01/2006; 150; 360;
progress et due date sont en nombre de jours
en argument: les donnees sources (ex: Sheets("mySheet").Range("A1:D10"))
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 Sub createGanttChartType(data As Range) Charts.Add ActiveChart.ChartType = xlBarStacked ActiveChart.SetSourceData Source:=data, PlotBy:=xlColumns ActiveChart.Location Where:=xlLocationAsObject, Name:="GanttChartData" ActiveChart.PlotArea.Select With Selection.Border .Weight = xlThin .LineStyle = xlNone End With Selection.Interior.ColorIndex = xlNone ActiveChart.SeriesCollection(1).Select With Selection.Border .Weight = xlThin .LineStyle = xlNone End With Selection.Shadow = False Selection.InvertIfNegative = False Selection.Interior.ColorIndex = xlNone ActiveChart.SeriesCollection(2).Select With Selection.Interior .ColorIndex = 32 End With ActiveChart.SeriesCollection(3).Select With Selection.Interior .ColorIndex = 34 End With ActiveChart.Axes(xlCategory).Select With Selection .CrossesAt = 1 .TickLabelSpacing = 1 .TickMarkSpacing = 1 .AxisBetweenCategories = True .ReversePlotOrder = True End With Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .FontStyle = "Regular" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.Axes(xlValue).Select With Selection .MinimumScale = data.Cells(2, 2).value .MaximumScale = data.Cells(data.Rows.Count, 2) + data.Cells(data.Rows.Count, 3) + _ data.Cells(data.Rows.Count, 4) .MinorUnitIsAuto = True .MajorUnitIsAuto = True .Crosses = xlMaximum .ReversePlotOrder = False .ScaleType = xlLinear .DisplayUnit = xlNone End With Selection.TickLabels.AutoScaleFont = True With Selection.TickLabels.Font .Name = "Arial" .FontStyle = "Bold" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With With Selection.TickLabels .ReadingOrder = xlContext .Orientation = 45 End With ActiveChart.Legend.Select Selection.Position = xlBottom ActiveChart.Legend.LegendEntries(1).Select Selection.Delete End Sub
Partager