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
| Option Explicit
Sub d_Traitement_part1()
Dim LastLig As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
LastLig = Sheets("Final Data").Cells(Cells.Rows.Count, 1).End(xlUp).Row
'Creation et preparation --> Feuille Traitement GLOBAL
Sheets.Add After:=Sheets("Final Data")
ActiveSheet.Name = "Traitement-GLOBAL"
Sheets("Final Data").Activate
Application.CutCopyMode = False
Range("A1:B" & LastLig).Copy
Sheets("Traitement-GLOBAL").Activate
Range("A2").Activate
ActiveSheet.Paste
Range("B2").Value = "Episodes AC"
Sheets("Final Data").Activate
Application.CutCopyMode = False
Range("Y1:Y" & LastLig).Copy
Sheets("Traitement-GLOBAL").Activate
Range("C2").Activate
ActiveSheet.Paste
Range("C2").Value = "Posters"
Range("D2").Value = "EP + POS"
Range("D3").Formula = "=IF(AND(B3<>"""",C3=""POS""),1,"""")"
Range("D4").Formula = "=IF(AND(B4<>"""",C4=""POS"",B4<>B3),COUNT(D3)+1,"""")"
Range("D5").Formula = "=IF(AND(B5<>"""",C5=""POS"",B5<>B4),COUNT(D$3:D4)+1,"""")"
Range("D5").AutoFill Destination:=Range("D5:D" & LastLig), Type:=xlFillDefault
Columns("A:D").EntireColumn.AutoFit
'Traitement-GLOBAL - Computation --> Episodes
Range("E1").Value = "AC (affinage)"
Range("E2").Value = "Mem Deb"
Range("F2").Value = "Mem Fin"
Range("G2").Value = "Duree"
Range("H2").Value = "Latence"
Range(Cells(2, 1), Cells(2, 44)).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'*Mem Deb AC
Range("E3").FormulaR1C1 = "=IF('Final Data'!R[-1]C[-3]<>"""",RC1,"""")"
Range("E4").FormulaR1C1 = _
"=IF(AND('Final Data'!R[-1]C[-3]<>"""",'Final Data'!R[-1]C[-3]<>'Final Data'!R[-2]C[-3]),RC1,R[-1]C)"
'*Mem Fin AC
Range("F4").FormulaR1C1 = _
"=IF(RC[-1]="""","""",IF(AND('Final Data'!R[-1]C[-4]<>"""",'Final Data'!R[-1]C[-4]<>'Final Data'!RC[-4]),RC1,R[-1]C))"
'*Duree AC
Range("G4").FormulaR1C1 = "=IF(RC[-1]<>R[-1]C[-1],RC[-1]-RC[-2],"""")"
Range("E4:G4").AutoFill Destination:=Range("E4:G" & LastLig), Type:=xlFillDefault
'*Latence AC
Range("H3").FormulaR1C1 = _
"=IF(RC[-2]="""","""",IF(RC[-3]<>R[-1]C[-3],RC[-3]-RC[-2],""""))"
Range("H3").AutoFill Destination:=Range("H3:H" & LastLig), Type:=xlFillDefault
Range("H1:H" & LastLig).Select
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThick
End With
Application.Calculation = xlCalculationAutomatic
Range("D1:H" & LastLig).Value = Range("D1:H" & LastLig).Value
End Sub |
Partager