spencerp237
03-23-2017, 09:04 AM
I have tried doing this:
Sub MoveHighlightedErrors()
Dim rowIndex As Long
rowIndex = 3
With Sheets("Sheet1")
For i = 4 To .Range("E4").CurrentRegion.Rows.Count
If .Cells(i, 9).Interior.Color = 65535 And .Cells(i, 11).Interior.Color = 65535 Then
Sheets("Sheet1").Range(.Cells(i, 5), .Cells(i, 11)).Copy Destination:=Sheets("Sheet2").Rows(rowIndex)
rowIndex = rowIndex + 1
End If
Next i
End With
End Sub
Which unfortunately doesn't work. I'm not sure how to properly read a highlighted cell.
Columns I and K could be highlighted. If they are both highlighted, I want to copy columns E:K for that row, and copy it to Sheet2 starting on row 3.
*Edit
The highlighted cells are conditionally formatted
Sub MoveHighlightedErrors()
Dim rowIndex As Long
rowIndex = 3
With Sheets("Sheet1")
For i = 4 To .Range("E4").CurrentRegion.Rows.Count
If .Cells(i, 9).Interior.Color = 65535 And .Cells(i, 11).Interior.Color = 65535 Then
Sheets("Sheet1").Range(.Cells(i, 5), .Cells(i, 11)).Copy Destination:=Sheets("Sheet2").Rows(rowIndex)
rowIndex = rowIndex + 1
End If
Next i
End With
End Sub
Which unfortunately doesn't work. I'm not sure how to properly read a highlighted cell.
Columns I and K could be highlighted. If they are both highlighted, I want to copy columns E:K for that row, and copy it to Sheet2 starting on row 3.
*Edit
The highlighted cells are conditionally formatted