-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMISRA_DrawChart.txt
190 lines (153 loc) · 7.99 KB
/
MISRA_DrawChart.txt
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
Sub DrawChart(Optional Sheetname As Worksheet, Optional FileName As String, Optional ColumnName As String)
Sheetname.Shapes.AddChart.Select
Dim TempSeriesName As String
Dim TempSeriesValue As String
'Chart for All data for each module
With ActiveChart
ActiveChart.ChartType = xlLineMarkers
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = FileName & " All"
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$2"
TempSeriesValue = "=" & FileName & "!$B$2:$" & ColumnName & "$2"
ActiveChart.FullSeriesCollection(1).Name = TempSeriesName
ActiveChart.FullSeriesCollection(1).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$7"
TempSeriesValue = "=" & FileName & "!$B$7:$" & ColumnName & "$7"
ActiveChart.FullSeriesCollection(2).Name = TempSeriesName
ActiveChart.FullSeriesCollection(2).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$12"
TempSeriesValue = "=" & FileName & "!$B$12:$" & ColumnName & "$12"
ActiveChart.FullSeriesCollection(3).Name = TempSeriesName
ActiveChart.FullSeriesCollection(3).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$17"
TempSeriesValue = "=" & FileName & "!$B$17:$" & ColumnName & "$17"
ActiveChart.FullSeriesCollection(4).Name = TempSeriesName
ActiveChart.FullSeriesCollection(4).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$22"
TempSeriesValue = "=" & FileName & "!$B$22:$" & ColumnName & "$22"
ActiveChart.FullSeriesCollection(5).Name = TempSeriesName
ActiveChart.FullSeriesCollection(5).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$27"
TempSeriesValue = "=" & FileName & "!$B$27:$" & ColumnName & "$27"
ActiveChart.FullSeriesCollection(6).Name = TempSeriesName
ActiveChart.FullSeriesCollection(6).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$32"
TempSeriesValue = "=" & FileName & "!$B$32:$" & ColumnName & "$32"
ActiveChart.FullSeriesCollection(7).Name = TempSeriesName
ActiveChart.FullSeriesCollection(7).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$37"
TempSeriesValue = "=" & FileName & "!$B$37:$" & ColumnName & "$37"
ActiveChart.FullSeriesCollection(8).Name = TempSeriesName
ActiveChart.FullSeriesCollection(8).Values = TempSeriesValue
TempSeriesValue = "=" & FileName & "!$B$1:$" & ColumnName & "$1"
ActiveChart.FullSeriesCollection(1).XValues = TempSeriesValue
With ActiveChart.Parent
.Top = Range("W21").Top
.Left = Range("W21").Left
End With
End With
Sheetname.Shapes.AddChart.Select
'Chart for All data for each Supplier
With ActiveChart
ActiveChart.ChartType = xlLineMarkers
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = FileName
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$54"
TempSeriesValue = "=" & FileName & "!$B$54:$" & ColumnName & "$54"
ActiveChart.FullSeriesCollection(1).Name = TempSeriesName
ActiveChart.FullSeriesCollection(1).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$55"
TempSeriesValue = "=" & FileName & "!$B$55:$" & ColumnName & "$55"
ActiveChart.FullSeriesCollection(2).Name = TempSeriesName
ActiveChart.FullSeriesCollection(2).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$56"
TempSeriesValue = "=" & FileName & "!$B$56:$" & ColumnName & "$56"
ActiveChart.FullSeriesCollection(3).Name = TempSeriesName
ActiveChart.FullSeriesCollection(3).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$57"
TempSeriesValue = "=" & FileName & "!$B$57:$" & ColumnName & "$57"
ActiveChart.FullSeriesCollection(4).Name = TempSeriesName
ActiveChart.FullSeriesCollection(4).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$58"
TempSeriesValue = "=" & FileName & "!$B$58:$" & ColumnName & "$58"
ActiveChart.FullSeriesCollection(5).Name = TempSeriesName
ActiveChart.FullSeriesCollection(5).Values = TempSeriesValue
TempSeriesValue = "=" & FileName & "!$B$1:$" & ColumnName & "$1"
ActiveChart.FullSeriesCollection(1).XValues = TempSeriesValue
With ActiveChart.Parent
.Top = Range("W37").Top
.Left = Range("W37").Left
End With
End With
Sheetname.Shapes.AddChart.Select
'Chart for SWP Only data for each module
With ActiveChart
ActiveChart.ChartType = xlLineMarkers
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = FileName & " SWP Only"
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$2"
TempSeriesValue = "=" & FileName & "!$B$5:$" & ColumnName & "$5"
ActiveChart.FullSeriesCollection(1).Name = TempSeriesName
ActiveChart.FullSeriesCollection(1).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$7"
TempSeriesValue = "=" & FileName & "!$B$10:$" & ColumnName & "$10"
ActiveChart.FullSeriesCollection(2).Name = TempSeriesName
ActiveChart.FullSeriesCollection(2).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$12"
TempSeriesValue = "=" & FileName & "!$B$15:$" & ColumnName & "$15"
ActiveChart.FullSeriesCollection(3).Name = TempSeriesName
ActiveChart.FullSeriesCollection(3).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$17"
TempSeriesValue = "=" & FileName & "!$B$20:$" & ColumnName & "$20"
ActiveChart.FullSeriesCollection(4).Name = TempSeriesName
ActiveChart.FullSeriesCollection(4).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$22"
TempSeriesValue = "=" & FileName & "!$B$25:$" & ColumnName & "$25"
ActiveChart.FullSeriesCollection(5).Name = TempSeriesName
ActiveChart.FullSeriesCollection(5).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$27"
TempSeriesValue = "=" & FileName & "!$B$30:$" & ColumnName & "$30"
ActiveChart.FullSeriesCollection(6).Name = TempSeriesName
ActiveChart.FullSeriesCollection(6).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$32"
TempSeriesValue = "=" & FileName & "!$B$35:$" & ColumnName & "$35"
ActiveChart.FullSeriesCollection(7).Name = TempSeriesName
ActiveChart.FullSeriesCollection(7).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$37"
TempSeriesValue = "=" & FileName & "!$B$40:$" & ColumnName & "$40"
ActiveChart.FullSeriesCollection(8).Name = TempSeriesName
ActiveChart.FullSeriesCollection(8).Values = TempSeriesValue
ActiveChart.SeriesCollection.NewSeries
TempSeriesName = "=" & FileName & "!$A$42"
TempSeriesValue = "=" & FileName & "!$B$45:$" & ColumnName & "$45"
ActiveChart.FullSeriesCollection(9).Name = TempSeriesName
ActiveChart.FullSeriesCollection(9).Values = TempSeriesValue
TempSeriesValue = "=" & FileName & "!$B$1:$" & ColumnName & "$1"
ActiveChart.FullSeriesCollection(1).XValues = TempSeriesValue
With ActiveChart.Parent
.Top = Range("W5").Top
.Left = Range("W5").Left
End With
End With
End Sub