allrow = 20: firstrow = "": lastrow = "" For i = 1 To allrow If Cells(i, 1).Interior.Color = vbYellow And firstrow = "" Then firstrow = i If Cells(allrow + 1 - i, 1).Interior.Color = vbYellow And lastrow = "" Then lastrow = allrow + 1 - i If firstrow <> "" And lastrow <> "" Then Exit For Next i Range(Cells(firstrow, 1), Cells(lastrow, "j")).Select