Bonjour la communauté,
j'ai rajouté une colonne dans le métier préparateur, j'ai modifié le code comme suit
Option Explicit
Option Compare Text
Sub erreur()
Dim F1 As Range
Dim F2 As Range
Dim I As Integer
Dim j As Integer
Dim k As Integer
Dim DernLigne1 As Long
Dim DernLigne2 As Long
DernLigne1 = Range("A" & Rows.Count).End(xlUp).Row
DernLigne2 = Range("AB" & Rows.Count).End(xlUp).Row + 1
Set F1 = ActiveSheet.Range("A1:A" & DernLigne1)
Set F2 = ActiveSheet.Range("AB4:AE" & DernLigne2)
ActiveSheet.Range("AB4:AE" & DernLigne2).ClearContents
For j = 1 To F2.Rows.Count
For k = 2 To 33
For I = 1 To F1.Rows.Count
If F1(I, k).Value = 1 And F1(I, 1).Value <> "TOTAL" Then
F2(j, 1).Value = F1(I, 1).Value
F2(j, 2).Value = Cells(2, k).Value
If Cells(2, k).Value = "PREPARATEUR" And Cells(I, k + 1).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 1).Value
F2(j, 4).Value = Cells(I, k + 3).Value
End If
If Cells(2, k).Value = "PREPARATEUR" And Cells(I, k + 2).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 2).Value
F2(j, 4).Value = Cells(I, k + 3).Value
If Cells(2, k).Value = "PREPARATEUR" And Cells(I, k + 3).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 3).Value
F2(j, 4).Value = Cells(I, k + 3).Value
End If
If Cells(2, k).Value = "CARISTE" And Cells(I, k + 1).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 1).Value
F2(j, 4).Value = Cells(I, k + 4).Value
End If
If Cells(2, k).Value = "CARISTE" And Cells(I, k + 2).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 2).Value
F2(j, 4).Value = Cells(I, k + 4).Value
End If
If Cells(2, k).Value = "CARISTE" And Cells(I, k + 3).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 3).Value
F2(j, 4).Value = Cells(I, k + 4).Value
End If
If Cells(2, k).Value = "RECEPTION" And Cells(I, k + 1).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 1).Value
F2(j, 4).Value = Cells(I, k + 2).Value
End If
If Cells(2, k).Value = "CONTRÔLE" And Cells(I, k + 1).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 1).Value
F2(j, 4).Value = Cells(I, k + 4).Value
End If
If Cells(2, k).Value = "CONTRÔLE" And Cells(I, k + 2).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 2).Value
F2(j, 4).Value = Cells(I, k + 4).Value
End If
If Cells(2, k).Value = "CONTRÔLE" And Cells(I, k + 3).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 3).Value
F2(j, 4).Value = Cells(I, k + 4).Value
End If
If Cells(2, k).Value = "CHARGEMENT" And Cells(I, k + 1).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 1).Value
F2(j, 4).Value = Cells(I, k + 3).Value
End If
If Cells(2, k).Value = "CHARGEMENT" And Cells(I, k + 2).Value = "x" Then
F2(j, 3).Value = Cells(3, k + 2).Value
F2(j, 4).Value = Cells(I, k + 3).Value
End If
j = j + 1
End If
Next I
Next k
Next j
End Sub
J'obtiens le message " erreur de compilation : Next sans For " lorsque j'execute la macro.