PDA

View Full Version : How to prevent duplicate value



MA96
08-23-2022, 10:33 AM
Dear All,

how to prevent duplicate value in VBA Excel ?

thanks

georgiboy
08-24-2022, 04:46 AM
You can do this with 'Data Validation'

If your data is in column A then:

Select the whole of column A
Goto 'Data' in the ribbon
Select 'Data Validation'
Change the 'Allow' dropdown to 'Custom'
Enter formula: =COUNTIF(A:A,A1)=1
Click OK

Then try an enter a duplicate in column A