Hi
Use this function to identify the duplicate.
Code:
Function ISDUPLICATE(ByVal ExeDate As Date, AccountName As String) As Boolean
Dim k As Variant, i As Long, d As Long
AccountName = LCase(AccountName)
d = CLng(ExeDate)
With Worksheets("EXEC Plan")
k = .Range("s6:t" & .Range("s" & .Rows.Count).End(3).row).Value2
For i = 1 To UBound(k, 1)
If k(i, 1) = d And LCase(k(i, 2)) = AccountName Then
ISDUPLICATE = True
Exit Function
End If
Next
End With
End Function
and in your sub use it like
Code:
If ISDUPLICATE(CDate(Range("b6").Value), Range("c6")) Then Exit Sub
Bookmarks