Sub testage()
'
Dim MaxAuthorized As Integer
Dim ReplaceValue As Integer
Dim k As Integer
Dim nblignes As Integer
Dim nbcolones As Integer
ReplaceValue = -43
MaxAuthorized = 6
nbcolones = Range("A1", Range("A1").End(xlToRight)).Columns.Count
nblignes = Range("A1", Range("A1").End(xlDown)).Rows.Count
Sheets.Add After:=Sheets(Sheets.Count)
Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISNUMBER('31407-A01'!RC[0]),'31407-A01'!RC[0]," & ReplaceValue & ")"
Selection.AutoFill Destination:=Range("A2:A" & nblignes & ""), Type:=xlFillDefault
Range("A2:A387").Select
Selection.AutoFill Destination:=Range("A2:AI" & nblignes & ""), Type:=xlFillDefault
Range("A1").Select
ActiveCell.FormulaR1C1 = "='31407-A01'!RC[0]"
Selection.AutoFill Destination:=Range("A1:AH1"), Type:=xlFillDefault
Range("A1").End(xlToRight).Offset(1, 1).Select
ActiveCell.FormulaR1C1 = "=COUNTIF(RC[-33]:RC[-1]," & ReplaceValue & ")"
Selection.AutoFill Destination:=Range("AI2:AI" & nblignes & ""), Type:=xlFillDefault
'
End Sub