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

 

엑사남 12강 Study

 

엑셀 파일 다운로드

조건에 따른 색 변경 이벤트.xlsm
0.04MB

Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Range("l2,l5")) Is Nothing Then Exit Sub

If Target.Count > 1 Then Exit Sub

Dim strS As String
Dim lngN As String
Dim rngR As Range
Dim i As Long

strS = Range("l2").Value
lngN = Range("l5").Value

Set rngR = Range("b3:i22")
    '값이 아닌 객체는 반드시 Set 선언
rngR.Interior.ColorIndex = 0
    
    For i = 3 To 22
        If Range("d" & i) = strS And Range("i" & i) >= lngN Then
            Range("b" & i).Resize(1, 8).Interior.ColorIndex = 6
        Else
        End If
    Next i
End Sub
320x100

+ Recent posts