1 2 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
| Sub Marcel_CopierColler_classeur()
Dim r As Long
Dim derniereLigne As Long, dernierecol As Long
Dim wks1 As Worksheet, wks2 As Worksheet
Dim k As Long
Set wks1 = Worksheets("Feuille1")
Set wks2 = Worksheets("Feuille2")
With wks2
k = .Cells(.Rows.Count, 1).End(xlUp).Row
If k > 1 Then k = k + 1
End With
With wks1
derniereLigne = .Cells(.Rows.Count, 1).End(xlUp).Row
dernierecol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For r = derniereLigne To 1 Step -1
With .Range("A" & r)
If .Value = "oui" Then
.Resize(1, dernierecol).Copy
wks2.Paste Destination:=wks2.Cells(k, 1)
Application.CutCopyMode = False
.EntireRow.Delete
k = k + 1
End If
End With
Next r
End With
Set wks1 = Nothing
Set wks2 = Nothing
End Sub |
Partager