(Solved) – To check multiple criteria with duplicate values in various columns at the same time


I am trying to build the code to throw the message on following criteria. one to check the condition on four cells values which are in number are equal to all or not and then to check duplicate values from column range C6:C21 with I6:I25 AND column E6:E21 with K6:K25
Please help me in correction of the code.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("Q9") = Range("Q10") And Range("Q6") = Range("Q9") Then ' To check four cells are equal to respective to their data or not.
MsgBox "Number of coming staffs were matched with pick and drop entries, click ok to check duplicate entries.", vbOKOnly, ""

If Range("C6:21") <> Range("I6:I25") And Range("E6:E21") <> Range("K6:K25") Then  'for duplicate values in the mentioned column range

MsgBox "Click OK to PRINT (Ctrl P)", vbOKOnly, " "
bTemp = Application.Dialogs(xlDialogPrint).Show

        MsgBox "Check Schedule Properly or generate mail for additional car required by chosing Car Type", vbOKOnly, " "

End If
End If
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *