| 12
 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
 
 | Sub EXT_stats()
 
Dim d As Integer
 
For d = 3 To 7
 
Worksheets("sheet" & d).Visible = 1
 
Next d
 
    Sheets("data_brut").Select
    ' Find the last row of data
 
    FinalRow = Range("B65536").End(xlUp).Row
 
    For x = 1 To FinalRow
 
        Status = Cells(x, 1).Value
        TypeFile1 = Cells(x, 5).Value
        TypeFile2 = Cells(x, 5).Value
        TypeFile3 = Cells(x, 5).Value
 
        If Status = "IN OK" And TypeFile1 = "TITI" Then
            Cells(x, 1).Resize(1, 10).Copy
            Sheets("Sheet3").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Sheets("data_brut").Select
 
        ElseIf Status = "OUT OK" And TypeFile2 = "TOTO" Then
            Cells(x, 1).Resize(1, 10).Copy
            Sheets("Sheet4").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Sheets("data_brut").Select
 
        ElseIf Status = "OUT OK" And TypeFile3 = "TUTU" Then
            Cells(x, 1).Resize(1, 10).Copy
            Sheets("Sheet5").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Sheets("data_brut").Select
 
         ElseIf Status = "IN OK" And TypeFile3 = "TATA" Then
            Cells(x, 1).Resize(1, 10).Copy
            Sheets("Sheet6").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Sheets("data_brut").Select
 
         ElseIf Status = "IN OK" And TypeFile3 = "TETE" Then
            Cells(x, 1).Resize(1, 10).Copy
            Sheets("Sheet7").Select
            NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
            Cells(NextRow, 1).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Sheets("data_brut").Select
 
 
        End If
 
      Next x
 
   Sheets("EXT_stats").Select
 
End Sub | 
Partager