Hello
I made a macro to move entire row to the end of sheet based on cell color
Macro is working fine but if 2 or more consecutive rows meet the criteria it skips one, this is because if rows 2 &3 meet the criteria, after moving row 2, row 3 becomes 2 and is considered done
Thanks
I made a macro to move entire row to the end of sheet based on cell color
Macro is working fine but if 2 or more consecutive rows meet the criteria it skips one, this is because if rows 2 &3 meet the criteria, after moving row 2, row 3 becomes 2 and is considered done
Thanks
VBA Code:
Sub Test()
Dim MR As Excel.Range
Dim rngCell As Excel.Range
Dim rngCount As Long
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Strip. & Other")
Set MR = Sheets("Strip. & Other").Range("L1:L300")
rngCount = 1
For Each rngCell In MR
If rngCell.DisplayFormat.Interior.Color = RGB(255, 192, 0) Then
rngCell.Select
ActiveCell.EntireRow.Cut
iRow = ws.Range("B:B").Find(What:="*", SearchOrder:=xlRows, SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
Range("A" & iRow).Select
Selection.Insert Shift:=xlDown
Else: GoTo 1
End If
1
Next rngCell
End Sub