Dear all,
I have a Sales worksheet that will be populated through the Userform (as below) which consists of 5 columns. The userform Record button will write the contents of the form to the Sales worksheet.
I know how to write the code to write the value in every textbox, combobox or else to the worksheet.
However, I would like to prevent duplication by checking first if value in 2 boxes in the userform are not already on the Sales worksheet. So therefore, if there is a duplication of those 2 values simultaneously, then the Sub will display a message box "Duplicate!" and then will Exit Sub.
On the Sales spreadsheet, the 2 columns that will be checked for duplication are D (Supplier) and E(Reporting Month).
So as an example based on the data already on the worksheet, if the userform includes the Silo Tours and Jun-18 to be recorded, this will display the pop up warning message of Duplicate and will exit the sub. However, if it is Silo Tours and Aug-18 then it will write the values on the form into the corresponding columns cells.
I think there are various ways of doing such as through filter, Countif or Index Match and etc.
So I need a VBA code to check whether the combination Supplier and Reporting MOnth do not already exist on the Sales worksheet.
Can you help please. Thank you for your time and consideration.
[ATTACH=JSON]{"alt":"VBA Form","data-align":"none","data-size":"full","title":"Userform to Record","data-attachmentid":1212887}[/ATTACH]