엑셀(Excel) - 두 컬럼의 값 비교(VBA)
* 카페에 남겼던 댓글.
C열의 값이 바뀔 때, B 열의 값과 비교해서 메시지 출력. (소리 재생은 생략)
예)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range(\"C:C\")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
If Range(\"B\" & Target.Row).Value = Target.Value Then
MsgBox(\"O 맞았어요~\")
Else
MsgBox (\"X 틀렸어요~\")
End If
End If
End Sub
C열의 값이 바뀔 때, B 열의 값과 비교해서 메시지 출력. (소리 재생은 생략)
예)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range(\"C:C\")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
If Range(\"B\" & Target.Row).Value = Target.Value Then
MsgBox(\"O 맞았어요~\")
Else
MsgBox (\"X 틀렸어요~\")
End If
End If
End Sub
목록
함께 나눈 이야기
댓글댓글 남기기