ⓒ 2025 AI교육연구회 withseok. All rights reserved. (위드석)
[블로그 글 내용 상업적 이용금지] 위드석홈 | 위드석개발 | AI교육연구회

엑사남5강 Study

동적범위, 빨간색으로 변경

엑셀 파일 다운로드

end(xlUp), end(xlToLeft), lngR, lngC, Cells, Font.ColorIndex, for, next.xlsm
0.04MB

Sub 오십점이하빨강()

Dim i As Long
Dim j As Long
Dim lngR As Long
Dim lngC As Long
    
lngR = Cells(Rows.Count, "a").End(xlUp).Row
    '아래의 둘 중 선택
    'Cells(Rows.Count, "a").end(xlUp).Row
    'Range("a1048576").end(xlUp).Row
lngC = Cells(2, Columns.Count).End(xlToLeft).Column
    '왼쪽은 to가 붙는다.
    'xlup과 xltoleft의 차이
    
    For i = 2 To lngR
        For j = 3 To lngC
            If Cells(i, j) <= 50 Then
                Cells(i, j).Font.ColorIndex = 3
            End If
        Next
    Next

End Sub
Sub 오십점이하검정()

Dim i As Long
Dim j As Long
Dim lngR As Long
Dim lngC As Long
    
lngR = Cells(Rows.Count, "a").End(xlUp).Row
    '아래의 둘 중 선택
    'Cells(Rows.Count, "a").end(xlUp).Row
    'Range("a1048576").end(xlUp).Row
lngC = Cells(2, Columns.Count).End(xlToLeft).Column
    '왼쪽은 to가 붙는다.
    'xlup과 xltoleft의 차이
    
    For i = 2 To lngR
        For j = 3 To lngC
            If Cells(i, j) <= 50 Then
                Cells(i, j).Font.ColorIndex = 1
            End If
        Next
    Next

End Sub
320x100

+ Recent posts