'목록하단 광고 치환자(withSeok)
728x90

엑사남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
728x90

+ Recent posts