Hi
I have a workbook where one worksheet contains data elements from a single patient chart.
With the brilliance of Skip I got the code below which compares column J to column B and highlights cell J if they are different.
However, now I have other columns I'd like to compare:
B40:B60 compared to J40:J60
C40:C60 compared to K40:K60
D4060 compared to L40:L60
How can I add these onto the current code OR can I have more than one worksheet_change event in the same worksheet?
Thanks.
I have a workbook where one worksheet contains data elements from a single patient chart.
With the brilliance of Skip I got the code below which compares column J to column B and highlights cell J if they are different.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t As Range, rng As Range
Set rng = Intersect(Rows("5:37"), Range([b1], [j1]).EntireColumn)
Me.Unprotect
Me.Cells.Locked = False
For Each t In Target
With t
'is change in column J?
If Not Intersect(t, rng, Cells(1, "J").EntireColumn) Is Nothing Then
If t.Value <> Cells(t.Row, "B").Value Then
.Interior.Color = 49407
Else
.Interior.ColorIndex = xlColorIndexNone
End If
End If
End With
Next
Set rng = Nothing
Me.Range("A1:A79,C5:H38,F40:H61,I5:I79,K5:P38,N40:P61,Q5:Q79").Locked = True
Me.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
However, now I have other columns I'd like to compare:
B40:B60 compared to J40:J60
C40:C60 compared to K40:K60
D4060 compared to L40:L60
How can I add these onto the current code OR can I have more than one worksheet_change event in the same worksheet?
Thanks.