Bonjour,
Une autre proposition, à tester,qui vérifie le nombre de X...
Cdlt.
* il y aura peut-être un souci avec les x et X.
Public Sub DEMO()
Dim wb As Workbook
Dim ws As Worksheet, ws2 As Worksheet
Dim rng As Range, Cell As Range
Dim lRow As Long
Application.ScreenUpdating = False
Set wb = ActiveWorkbook
Set ws = wb.Worksheets(2): Set ws2 = wb.Worksheets(3)
With ws
Set rng = Application.Union(.Range("F6:F78"), .Range("N6:N78"))
End With
With ws2
lRow = 7
.[A7:B30].ClearContents
For Each Cell In rng
If UCase(Cell.Value) = "X" Then
If Application.CountIf(Range(Cell.Offset(0, -3), Cell), "=X") > 1 Then
MsgBox "Veuillez vérifier vos saisies en ligne " & Cell.Row, vbCritical
GoTo fin
End If
.Cells(lRow, 1) = Cell.Offset(0, -5).Value
.Cells(lRow, 2) = Cell.Offset(0, -4).Value
lRow = lRow + 1
End If
Next Cell
.Activate
.[A1].Select
End With
fin:
Set rng = Nothing
Set ws2 = Nothing: Set ws = Nothing
Set wb = Nothing
Exit Sub
End Sub