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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
| Sub Création_des_Graphiques()
Dim Lig As Long
Dim NumLig As Long
Dim Lig2 As Long
Dim NumLig2 As Long
Dim Lig3 As Long
Dim NumLig3 As Long
Dim Col As Long
Dim NumCol As Long
Dim Col2 As Long
Dim NumCol2 As Long
Dim Diff1 As Double
Dim Diff2 As Double
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
Dim r As Integer
Dim Cpt As Integer
Dim CptSh As Integer
'###### CREATION DE L'ONGLET : DONNEES D'EXPERIMENTATIONS ######
Sheets.Add After:=Sheets(Sheets.Count - 2)
ActiveSheet.Name = ("Données d'expérimentations")
'###### DEPLACER LES DONNEES DE L'ONGLET DONNEES BRUTES A ANALYSE DES DONNEES ######
Sheets("Données Brutes").Select
Sheets("Données Brutes").Copy Before:=Sheets("Graphique")
Sheets("Données Brutes (2)").Select
Sheets("Données Brutes (2)").Name = "Analyse des données"
'###### SEPARER LES DONNEES D'EXPERIMENTATIONS ET RELEVE DE MESURES ######
Sheets("Données d'expérimentations").Activate
Cells.Select
Selection.ClearContents
Sheets("Analyse des données").Activate
NumLig = 0
Lig = 1
While Cells(Lig, 1).Value <> "Balayage"
NumLig = NumLig + 1
Lig = Lig + 1
Wend
range(Cells(1, 1), Cells(NumLig, 50)).Copy
Sheets("Données d'expérimentations").Activate
range("A1").PasteSpecial
Sheets("Analyse des données").Activate
range(Cells(1, 1), Cells(NumLig, 50)).Delete
Sheets("Données d'expérimentations").Activate
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Columns("D:D").EntireColumn.AutoFit
Columns("E:E").EntireColumn.AutoFit
Columns("F:F").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("H:H").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
Columns("K:K").EntireColumn.AutoFit
Columns("L:L").EntireColumn.AutoFit
Columns("M:M").EntireColumn.AutoFit
Columns("N:N").EntireColumn.AutoFit
Columns("O:O").EntireColumn.AutoFit
Columns("Q:Q").EntireColumn.AutoFit
Columns("R:R").EntireColumn.AutoFit
Columns("S:S").EntireColumn.AutoFit
Columns("T:T").EntireColumn.AutoFit
Sheets("Analyse des données").Activate
'##################### SUPPRESSION DES COLONNES INUTILES #####################
For a = 5 To 20
range(Cells(1, a), Cells(65530, a)).Select
Selection.Delete Shift:=xlToLeft
Next
'##################### CALCUL NOMBRE DE LIGNES ET COLONNES #####################
Col = 1
While Cells(2, Col).Value <> ""
NumCol = NumCol + 1
Col = Col + 1
Wend
Lig2 = 1
While Cells(Lig2, 1).Value <> ""
NumLig2 = NumLig2 + 1
Lig2 = Lig2 + 1
Wend
'##################### REMISE A ZERO DES TITRES DES COLONNES #####################
range("A1:ZZ1").Select
Selection.ClearContents
range("A1") = "Balayage"
range("B1") = "Date"
range("C1") = "Heure"
NumCapteur = 101
For b = 4 To NumCol
Cells(1, b) = NumCapteur
NumCapteur = NumCapteur + 1
Next
'##################### MISE EN FORME #####################
range(Cells(1, 1), Cells(NumLig2, NumCol)).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'######### CREATION DE L'ONGLET : ANALYSE DES DONNEES ET DE LA COLONNE TEMPS(H) #########
Sheets("Analyse des données").Activate
Columns("D:D").EntireColumn.Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Select
'########### TITRE ET FORMULE COLONNE TEMPS(H) ###########
range("D1") = "Temps (h)"
range("D2").FormulaLocal = "=GAUCHE(C2;8)"
range("D2").Select
Selection.AutoFill Destination:=ActiveCell.range(Cells(1, 1), Cells(NumLig2 - 1, 1))
ActiveCell.range(Cells(1, 1), Cells(NumLig2 - 1, 1)).Select
range("D2").Select
'######### CREATION DE LA COLONNE TEMPS REFERENCE (s) #########
Sheets("Analyse des données").Activate
Columns("E:E").EntireColumn.Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Select
'########## TITRE ET FORMULE COLONNE TEMPS REFERENCE (s) #########
range("E1") = "Temps référence (s)"
range("E2").FormulaLocal = "=ARRONDI((D2-$D$2)*(24*60*60);0)"
range("E3").FormulaLocal = "=ARRONDI((D3-$D$2)*(24*60*60);0)"
range("E4").FormulaLocal = "=ARRONDI((D4-$D$2)*(24*60*60);0)"
Diff1 = Cells(3, 5).Value - Cells(2, 5).Value
Diff2 = Cells(4, 5).Value - Cells(3, 5).Value
If Diff1 = Diff2 Then
c = Cells(3, 5).Value
End If
For d = 5 To NumLig2
Cells(d, 5) = Cells(d - 1, 5) + c
Next
Col2 = 1
While Cells(2, Col2).Value <> ""
NumCol2 = NumCol2 + 1
Col2 = Col2 + 1
Wend
Lig3 = 1
While Cells(Lig3, 1).Value <> ""
NumLig3 = NumLig3 + 1
Lig3 = Lig3 + 1
Wend
'####### REMPLACE LES POINTS PAR DES VIRGULES DANS LES COLONNES DE MESURES (A PARTIR DE F) ######
Sheets("Analyse des données").range(Cells(2, 6), Cells(NumLig3, NumCol2)).Replace What:=".", Replacement:=".", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
'##################### CREATION DES GRAPHIQUES #####################
NumCol2 = NumCol2 - 5
Worksheets("Graphique").Visible = 1
For i = 1 To NumCol2
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = ("Graphique " & i)
s = Sheets.Count - 1
For E = 1 To s
Sheets("Graphique " & i).Select
Sheets("Graphique " & i).Move After:=Sheets(E)
Next E
Sheets("Analyse des données").Select
range(Cells(2, 5 + i), Cells(NumLig3, 5 + i)).Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).Name = "='Analyse des données'!$" & ColLetter(Cells(1, 5 + i)) & "$1"
ActiveChart.SeriesCollection(1).XValues = "='Analyse des données'!$E$2:$E$" & NumLig3
ActiveChart.SeriesCollection(1).Values = "='Analyse des données'!$" & ColLetter(Cells(1, 5 + i)) & "$2:$" & ColLetter(Cells(1, 5 + i)) & "$" & NumLig3
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
ActiveChart.Parent.Cut
Sheets("Graphique " & i).Select
range("C6").Select
ActiveSheet.Paste
Sheets("Analyse des données").Select
'##################### AGRANDISSEMENT DES GRAPHIQUES #####################
Sheets("Graphique " & i).Select
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveSheet.Shapes("Graphique 1").IncrementLeft -87.75
ActiveSheet.Shapes("Graphique 1").IncrementTop -57
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveSheet.Shapes("Graphique 1").ScaleWidth 2.1270833333, msoFalse, _
msoScaleFromTopLeft
ActiveSheet.Shapes("Graphique 1").ScaleHeight 1.9444444444, msoFalse, _
msoScaleFromTopLeft
Next i
Worksheets("Graphique").Visible = 0
'##################### RENOMMER LES AXES DES GRAPHIQUES #####################
f = InputBox("Quel est le titre de l'axe des abscisses ?")
g = InputBox("Quel est le titre de l'axe des ordonnées ?")
For i = 1 To NumCol2
Sheets("Graphique " & i).Select
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.ApplyLayout (1)
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.Axes(xlCategory).AxisTitle.Select
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = f
Selection.Format.TextFrame2.TextRange.Characters.Text = f
With Selection.Format.TextFrame2.TextRange.ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 10
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Strike = msoNoStrike
End With
ActiveChart.Axes(xlValue).AxisTitle.Select
ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = g
Selection.Format.TextFrame2.TextRange.Characters.Text = g
With Selection.Format.TextFrame2.TextRange.ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 10
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Strike = msoNoStrike
End With
ActiveChart.ChartArea.Select
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Text = "Canal 10" & i
Selection.Format.TextFrame2.TextRange.Characters.Text = "Canal 10" & i
With Selection.Format.TextFrame2.TextRange.ParagraphFormat
.TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter
End With
With Selection.Format.TextFrame2.TextRange.Font
.BaselineOffset = 0
.Bold = msoTrue
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 0, 0)
.Fill.Transparency = 0
.Fill.Solid
.Size = 18
.Italic = msoFalse
.Kerning = 12
.Name = "+mn-lt"
.UnderlineStyle = msoNoUnderline
.Strike = msoNoStrike
End With
ActiveChart.ChartArea.Select
Next i
'##################### CREATION DE L'ONGLET DONNEES CIBLEES #####################
x = InputBox("Combien avez-vous de palier(s) d'étalonnage(s) ?")
For i = 1 To x
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "Données ciblées " & i
Sheets("Analyse des données").Select
Rows("1:1").Select
Selection.Copy
Sheets("Données ciblées " & i).Select
ActiveSheet.Paste
Next
End Sub |
Partager