Public Sub Move_colored_cells_rows()
' Instead of moving the entire row , 10 columns will be moved
' If more columns are to be included , modify this number
Const NUMBER_OF_COLUMNS = 10
Dim selected_cell As Range
Dim temp_cell As Range
Dim data_range As Range
Dim from_array As Variant
Dim to_array As Variant
ThisWorkbook.Worksheets("Sheet1").Activate
Set selected_cell = ActiveCell.EntireRow.Cells(1, 1)
selected_row = ActiveCell.Row
row_counter = 1
Set data_range = ThisWorkbook.Worksheets("Sheet1").Range("A2:B12")
data_range.Select
number_of_rows = Selection.Rows.Count
Set temp_cell = Selection.Cells(1, 1)
For i = 1 To number_of_rows
curr_cell_color = temp_cell.Offset(i - 1).Interior.ColorIndex
If curr_cell_color <> xlNone Then
curr_row = temp_cell.Offset(i - 1).Row
If curr_row > selected_row Then
from_array = temp_cell.Offset(i - 1).Resize(1, NUMBER_OF_COLUMNS).Value
to_array = selected_cell.Offset(row_counter).Resize(1, NUMBER_OF_COLUMNS).Value
temp_cell.Offset(i - 1).Resize(1, NUMBER_OF_COLUMNS).Value = to_array
selected_cell.Offset(row_counter).Resize(1, NUMBER_OF_COLUMNS).Value = from_array
temp_cell.Offset(i - 1).Interior.ColorIndex = selected_cell.Offset(row_counter).Interior.ColorIndex
selected_cell.Offset(row_counter).Interior.ColorIndex = curr_cell_color
row_counter = row_counter + 1
End If
End If
Next
End Sub