Hi guys,
I don't get the cell color change when I selected desired value in another cell. Please help!!
I think I need to move the second if condition into the first if statement to create if condition and if condition 2
But not sure how to do it.
I don't get the cell color change when I selected desired value in another cell. Please help!!
I think I need to move the second if condition into the first if statement to create if condition and if condition 2
But not sure how to do it.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$N$3" Then
V = Application.Match(Target.Value, Range("A21", [A21].End(xlDown)), 0)
Application.EnableEvents = False
If IsNumeric(V) Then
V = 20 + V
[B3].Value = Target.Value
[D3].Value = Cells(V, 2).Value
[F3].Value = Cells(V, 3).Value
[H3].Value = Cells(V, 4).Value
[B5].Value = Cells(V, 5).Value
[B7].Value = Cells(V, 6).Value
[B9].Value = Cells(V, 7).Value
[B11].Value = Cells(V, 8).Value
[B12].Value = Cells(V, 9).Value
[B13].Value = Cells(V, 10).Value
[B14].Value = Cells(V, 11).Value
Else
If [$N$3].Value = "Patient 1001" Then
Range("N10").Interior.ColorIndex = 4
Else
Range("O10").Interior.ColorIndex = 3
End If
If Target.Value > "" Then Beep
[B3,D3,F3,H3,B5,B7,B9,B11,B12.B13.B14].Value = ""
End If
Application.EnableEvents = True
End If
Attachments
Last edited by a moderator: