728x90

작업을 하다보면 색깔을 칠하면서 작업을 하게 된다. 그런데 마지막 색깔을 표시한 셀이 어디인지 찾기가 쉽지 않을 경우에 색상으로 마지막 셀을 찾는 방법이다.

배경색을 모를 경우 Msgbox Cells(2, 1).Interior.ColorIndex 를 하면 A2 셀의 배경색을 알아낼 수가 있다.


Sub last_colorcell_find()
    Dim r&, sRow&, eRow&
   
    sRow = 2
    eRow = Cells(Rows.Count, "A").End(3).Row
    Debug.Print Cells(2, 1).Interior.ColorIndex '// A2 셀의 배경색 알아내기
    For r = eRow To sRow Step -1
        If Cells(r, 1).Interior.ColorIndex = 14 Then   '// 녹색이면
            Cells(r, 1).Select
            Exit For
        End If
    Next r
End Sub



블로그 이미지

Link2Me

,