1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Sub aargh()
Set wsp = ThisWorkbook.Sheets("feuil1")
Set wba = Workbooks.Open("d:\downloads\archive.xlsx") ' à adapter nom & repertoire du classeur archive
Set wsa = ActiveWorkbook.Sheets("archive") ' à adapter nom de la feuille archive dans classeur archive
dla = wsa.Cells(Rows.Count, 1).End(xlUp).Row
dlp = wsp.Cells(Rows.Count, 5).End(xlUp).Row
i = 8
While i <= dlp
If UCase(wsp.Cells(i, 5)) = "S" Then
dla = dla + 1
wsa.Cells(dla, 1).Resize(, 7).Value = wsp.Range("B" & i & ":H" & i).Value
wsp.Rows(i).Delete shift:=xlUp
Else
i = i + 1
End If
Wend
wba.Close
End Sub |
Partager