Bonjour à tous,
@ curulis57 ... J'aime bien ce type message
Dans le fichier, SophieB a "Option explicit"
Il faut donc déclarer iRow1
Sub EXPORT_TOOL()
'
Dim sWk1 As Worksheet, sWk2 As Worksheet
Dim iRow1 As Long
Set sWk1 = Worksheets("EXPORT")
Set sWk2 = Worksheets("EXPORT TOOL")
'
If WorksheetFunction.CountIf(sWk1.Columns("M:M"), "KO") > 0 Then
MsgBox "KO repéré!" & Chr(10) & "Export annulé!", vbCritical + vbOKOnly, "Alerte"
Else
sWk2.Range("A2:G" & sWk2.Range("A" & Rows.Count).End(xlUp).Row).ClearContents
iRow1 = sWk1.Range("A" & Rows.Count).End(xlUp).Row
sWk2.Range("A2:E" & iRow1).Value = sWk1.Range("A2:E" & iRow1).Value
sWk2.Range("F2:G" & iRow1).Value = sWk1.Range("J2:K" & iRow1).Value
End If
'
End Sub
ric