Hi,
There are 2 sheets Budget Summary and Approved.
Column B in Budget Summary has a list of names. Column F in Approved is where names are pasted. The names are pasted from different sources.
I have a code that highlights Column F in Approved sheet, if data entered is not an Exact Match with data in Column B in Budget Summary.
The problem -
The code highlights column F even if the data pasted is an Exact Match.
I'm unable to figure out if there is anything wrong with the code.
Have attached sample sheet.
Kindly assist.
POST MOVED BY MODERATOR
.
There are 2 sheets Budget Summary and Approved.
Column B in Budget Summary has a list of names. Column F in Approved is where names are pasted. The names are pasted from different sources.
I have a code that highlights Column F in Approved sheet, if data entered is not an Exact Match with data in Column B in Budget Summary.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Long
Dim m As Long
Dim n As Long
m = Worksheets("Approved").Range("F" & Rows.Count).End(xlUp).Row
n = Worksheets("Budget Summary").Range("B" & Rows.Count).End(xlUp).Row
Range("F1:F" & m).Interior.ColorIndex = xlColorIndexNone
For r = 1 To m
If Evaluate("ISERROR(MATCH(TRUE,EXACT(Approved!F" & r & ",Budget Summary!$B$1:$B" & n & "),0))") Then
Worksheets("Approved").Range("F" & r).Interior.Color = vbRed
End If
Next r
End Sub
The problem -
The code highlights column F even if the data pasted is an Exact Match.
I'm unable to figure out if there is anything wrong with the code.
Have attached sample sheet.
Kindly assist.
POST MOVED BY MODERATOR
.
Attachments
Last edited by a moderator: