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
| Sub CSE_DEV_2()
'
' CSE_DEV_2 Macro
'
'
ChDir "\\S013576V\Logs"
Workbooks.OpenText Filename:="\\..........\............\aefad_stats.log", Local:=True, Origin:= _
xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote _
, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma:= _
False, Space:=True, Other:=False, FieldInfo:=Array(Array(1, 5), Array(2, 1), _
Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), TrailingMinusNumbers:=True
ChDir "C:\Users\...............................\aefad_stats_DEV_Delta.csv"
' Début ne pas afficher alertes
Application.DisplayAlerts = False
' Début Enregistrer sous
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\...............................\aefad_stats_DEV_Delta.csv\aefad_stats_DEV_Delta.csv", _
FileFormat:=xlCSV, Local:=True, CreateBackup:=False
'Début de la variable permetant de compter le nombre de ligne non-vide
Dim MaxColA As Long
MaxColA = Range("A" & Rows.Count).End(xlUp).Row
'Demande la date de début
Dim DateDebut As Date
DateDebut = InputBox("Veuillez entrer la de début :", "")
'Demande la date de fin
Dim DateFin As Date
DateFin = InputBox("Veuillez entrer la date de fin :", "")
'Affiche le choix des dates
MsgBox "Votre choix: de " & DateDebut & " à " & DateFin & ""
'Efface les lignes hors date
For i=1 to 20
If Cells(i, 1).Value < DateDebut Or Cells(i, 1) > DateFin Then
Rows(i).Delete shift:=xlUp
End If
Next i
'Début mise en forme de la date
Columns("A:A").Select
Selection.NumberFormat = "yyyy-mm-dd;@"
'Début triage par date puis heure, soit Colonne A puis Colonne B
ActiveWorkbook.Worksheets("aefad_stats_DEV_Delta").Sort.SortFields.Add Key:= _
Range("A1:A" & MaxColA), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("aefad_stats_DEV_Delta").Sort.SortFields.Add Key:= _
Range("B1:B" & MaxColA), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
'Debut - Ajoute la valeur Developpement a la colonne G (SOLUTION 1)
'Dim MaxColA As Long
'MaxColA = Range("A" & Rows.Count).End(xlUp).Row
'Range("G1:G" & MaxColA).Value = "Developpement"
'Debut - Ajoute la valeur Developpement a la colonne G (SOLUTION 2)
ActiveSheet.UsedRange.Columns(7).Value = "Developement"
' Début Enregistrer sous
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\...............................\aefad_stats_DEV_Delta.csv", _
FileFormat:=xlCSV, Local:=True, CreateBackup:=False
ActiveWindow.Close
' Début afficher alertes
Application.DisplayAlerts = True
End Sub |
Partager