I am struggling with selecting and cutting a row based on a condition (Start date "B" < Not Before date "C") for example highlighted cell B2 and inserting previously cut row one row down.
Can someone kindly help me out.
Initial order: A, B, C, D, E, F, G, H and I
Order after processing: B, A, C, D, E, F, G, H and I
The code I am using
Can someone kindly help me out.
Initial order: A, B, C, D, E, F, G, H and I
Order after processing: B, A, C, D, E, F, G, H and I
The code I am using
Code:
Sub cutentirerowInsert1rowdown()
Dim rw As Long
With ActiveWorkbook.ActiveSheet
For rw = 2 To 10
.Cells(rw, 2).Select
If .Cells(rw, 2) < .Cells(rw, 3) Then 'If Start date less than Not Before date
ActiveCell.EntireRow.Select 'Select entire row
Selection.Cut 'Cut entire row
ActiveCell.EntireRow.Offset(2, 0).Activate
Selection.Insert Shift:=xlDown
End If
Next rw
End With
End Sub
Attachments
Last edited: