Dim i
Sub traite_classeur()
nb_onglet = Sheets.Count - 1
For i = 1 To nb_onglet
Sheets(i).Select
traite_feuille
Next
End Sub
Sub traite_feuille()
derligne = Range("A65536").End(xlUp).Row
Range("C1").FormulaR1C1 = "Derivate "
Range("D1").FormulaR1C1 = "V_corrigée"
Range("E1").FormulaR1C1 = "D_gche_Ddte"
Range("F1").FormulaR1C1 = "zone vibratoire_17"
Range("G1").FormulaR1C1 = "Delta"
Range("H1").FormulaR1C1 = "Moyenne_17"
Range("I1").FormulaR1C1 = "MAX glissant_20C"
Range("J1").FormulaR1C1 = "MIN glissant_20C"
Range("K1").FormulaR1C1 = "écart glissant_20C"
Range("L1").FormulaR1C1 = "MAX glissant_20D"
Range("M1").FormulaR1C1 = "MIN glissant_20D"
Range("N1").FormulaR1C1 = "écart glissant_20D"
Range("P1").FormulaR1C1 = "Max derivate "
Range("Q1").FormulaR1C1 = "Min derivate"
Range("R1").FormulaR1C1 = "ligne"
Range("S1").FormulaR1C1 = "amplitude_Droite"
Range("T1").FormulaR1C1 = "amplitude_Gauche"
Range("U1").FormulaR1C1 = "amplitude_Centrée"
Range("W1").FormulaR1C1 = "Max_Delta"
Range("X1").FormulaR1C1 = "ligne"
Range("Z1").FormulaR1C1 = "Max_écart glissant_20C"
Range("AA1").FormulaR1C1 = "ligne"
Range("AC1").FormulaR1C1 = "Max_écart glissant_20C"
Range("AD1").FormulaR1C1 = "ligne"
Range("P2").FormulaR1C1 = "=MAX(R[1]C[-13]:R[" & derligne - 2 & "]C[-13])"
Range("Q2").FormulaR1C1 = "=MIN(R[2]C[-14]:R[" & derligne - 1 & "]C[-14])"
Range("R2").FormulaR1C1 = "=MATCH(RC[-2]*(ABS(RC[-2])>ABS(RC[-1]))+RC[-1]*(ABS(RC[-2])<ABS(RC[-1])),R1C3:R" & derligne & "C3,0)"
Range("S2").FormulaArray = "=ABS(INDEX(C[-17],MIN(IF(SIGN(OFFSET(R[-1]C[-17],RC[-1],1," & derligne & "))<>SIGN(OFFSET(R[-1]C[-17],RC[-1]+1,1," & derligne & ")),ROW(OFFSET(R[-1]C[-17],RC[-1],1," & derligne & ")))))-OFFSET(R[-1]C[-17],RC[-1]-1,))"
Range("T2").FormulaArray = "=ABS(INDEX(C[-18],MAX(IF(SIGN(OFFSET(R[-1]C[-18],1,1,RC[-2]-2))<>SIGN(OFFSET(R[-1]C[-18],RC[-2]-1,1)),ROW(OFFSET(R[-1]C[-18],1,1,RC[-2]-2)))))-OFFSET(R[-1]C[-18],RC[-2]-1,))"
Range("V1").FormulaArray = "=MIN(IF(SIGN(OFFSET(RC[-20],R[1]C[-4],1," & derligne & "))<>SIGN(OFFSET(RC[-20],R[1]C[-4]+1,1," & derligne & ")),ROW(OFFSET(RC[-20],R[1]C[-4],1," & derligne & "))))"
Range("V2").FormulaArray = "=MAX(IF(SIGN(OFFSET(R[-1]C[-20],1,1,RC[-4]-2))<>SIGN(OFFSET(R[-1]C[-20],2,1,RC[-4]-2)),ROW(OFFSET(R[-1]C[-20],1,1,RC[-4]-2))))"
Range("U2").FormulaR1C1 = "=IF(SIGN(OFFSET(R[-1]C[-19],RC[-3]-1,1))=SIGN(OFFSET(R[-1]C[-19],RC[-3],1)),ABS(INDEX(C[-19],R[-1]C[1])-INDEX(C[-19],RC[1])),MAX(RC[-2]:RC[-1]))"
Range("W2").FormulaR1C1 = "=MAX(RC[-16]:R[" & derligne - 2 & "]C[-16])"
Range("X2").FormulaR1C1 = "=MATCH(RC[-1],C[-17],0)"
Range("Z2").FormulaR1C1 = "=MAX(RC[-15]:R[" & derligne - 2 & "]C[-15])"
Range("AA2").FormulaR1C1 = "=MATCH(RC[-1],C[-16],0)"
Range("AC2").FormulaR1C1 = "=MAX(RC[-15]:R[" & derligne - 2 & "]C[-15])"
Range("AD2").FormulaR1C1 = "=MATCH(RC[-1],C[-16],0)"
Range("C3").FormulaR1C1 = "=(RC[-1]-R[-1]C[-1])/(RC[-2]-R[-1]C[-2])"
Range("C3").AutoFill Destination:=Range("C3:C11"), Type:=xlFillDefault
Range("D2").FormulaArray = "=IF(RC[1],INDEX(C[-2],MIN(IF(R[1]C[1]:R" & derligne & "C5=1,ROW(R[1]C[-2]:R" & derligne & "C2)))),0)"
Range("D2").AutoFill Destination:=Range("D2:D11"), Type:=xlFillDefault
Range("E2").FormulaR1C1 = "1"
Range("E3").FormulaR1C1 = "=(SIGN(R[1]C[-2])<>SIGN(RC[-2]))*1"
Range("E3").AutoFill Destination:=Range("E3:E11"), Type:=xlFillDefault
Range("F2").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F3").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F4").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F5").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F6").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F7").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F8").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F9").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F10").FormulaR1C1 = "=IF(SUM(R2C[-1]:R[8]C[-1])<=5,0,1)"
Range("F11").FormulaR1C1 = "=IF(SUM(R[-8]C[-1]:R[8]C[-1])<=5,0,1)"
Range("G11").FormulaArray = "=IF(SIGN(R[1]C[-4])<>SIGN(RC[-4]),ABS(INDEX(C[-5],MIN(IF(R[1]C[-2]:R" & derligne & "C5=1,ROW(R[1]C[-2]:R" & derligne & "C5)),IF(R[1]C[-1]:R" & derligne & "C6=0,ROW(R[1]C[-1]:R" & derligne & "C6),999999)))-RC[-5]),0)"
Range("G11").AutoFill Destination:=Range("G3:G11"), Type:=xlFillDefault
Range("H11").FormulaR1C1 = "=AVERAGE(R[-8]C[-6]:R[8]C[-6])"
Range("H10").FormulaR1C1 = "=AVERAGE(R2C[-6]:R[8]C[-6])"
Range("H10").AutoFill Destination:=Range("H2:H10"), Type:=xlFillDefault
Range("I11").FormulaR1C1 = "=IF(SUM(R[-9]C[-3]:R[10]C[-3])=ROWS(R[-9]C[-3]:R[10]C[-3]),MAX(R[-9]C[-7]:R[10]C[-7]),0)"
Range("I10").FormulaR1C1 = "=IF(SUM(R2C[-3]:R[10]C[-3])=ROWS(R2C[-3]:R[10]C[-3]),MAX(R2C[-7]:R[10]C[-7]),0)"
Range("I10").AutoFill Destination:=Range("I2:I10"), Type:=xlFillDefault
Range("J11").FormulaR1C1 = "=IF(SUM(R[-9]C[-4]:R[10]C[-4])=ROWS(R[-9]C[-4]:R[10]C[-4]),MIN(R[-9]C[-8]:R[10]C[-8]),0)"
Range("J10").FormulaR1C1 = "=IF(SUM(R2C[-4]:R[10]C[-4])=ROWS(R2C[-4]:R[10]C[-4]),MIN(R2C[-8]:R[10]C[-8]),0)"
Range("J10").AutoFill Destination:=Range("J2:J10"), Type:=xlFillDefault
Range("K11").FormulaR1C1 = "=RC[-2]-RC[-1]"
Range("K11").AutoFill Destination:=Range("K2:K11"), Type:=xlFillDefault
Range("L11").FormulaR1C1 = "=IF(SUM(RC[-6]:R[19]C[-6])=20,MAX(RC[-10]:R[19]C[-10]),0)"
Range("L11").AutoFill Destination:=Range("L2:L11"), Type:=xlFillDefault
Range("M11").FormulaR1C1 = "=IF(SUM(RC[-7]:R[19]C[-7])=20,MIN(RC[-11]:R[19]C[-11]),0)"
Range("M11").AutoFill Destination:=Range("M2:M11"), Type:=xlFillDefault
Range("N11").FormulaR1C1 = "=RC[-2]-RC[-1]"
Range("N11").AutoFill Destination:=Range("N2:N11"), Type:=xlFillDefault
Range("C11:N11").AutoFill Destination:=Range("C11:N" & derligne & "")
Calculate
Range("P2:AD2").Copy
Sheets("Récap").Select
Range("B" & i + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
ActiveWindow.DisplayGridlines = False
Application.CutCopyMode = False
End Sub