Bonsoir ,
Je suis nouveau sur forum j'ai pensé que vous pourriez m'aider , alors voila dans le cadre d'un stage je dois réaliser à l'aide de VB un diagramme de gantt qui se fait dynamiquement à partir de données brutes , pour commencer j'ai trouvé ce code sur internet :
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
Malheureusement ce code ne fonctionne correctement que pour trois taches sauriez vous comment le modifier pour qu'il marche avec plus de trois taches ?
Merci .
Partager