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
|
Sub CreationOnglets()
Dim Rw As Range
Dim Ligne As Long
Sheets("Sheet1").Select
ActiveCell.SpecialCells(xlLastCell).Select
Range(Selection, Cells(1)).Select
For Each Rw In Selection.Rows
Ligne = Rw.Row + 5
If Rw.Cells(1, 4).Value = "M" Then
Rw.Copy Destination:=Worksheets("Sheet2").Cells(Ligne, 1).EntireRow
End If
Next Rw
'supprimer les lignes destination vides
Sheets("Sheet2").Activate
With ActiveSheet.UsedRange
derLi = .Row + .Rows.Count - 1
End With
Application.ScreenUpdating = False
'For r = derLi To 1 Step -1
'If Application.CountA(Rows(r)) = 0 Then
' Rows(r).Delete
' End If
'Next r
End Sub |
Partager