Тёмный

Prevent Duplicate Entries in Excel Automatically with VBA Macro 

Excel Destination
Подписаться 46 тыс.
Просмотров 45 тыс.
50% 1

This Excel VBA Tutorial explains how to prevent duplicate entries and allow only Unique Entries automatically. We can use simple vba code with looping statement and if condition to check if entered value is already existing in the same column. Also, how to delete entire record automatically if entered value in specific
column is duplicate.

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@vibhuvarshney1579
@vibhuvarshney1579 4 года назад
could you help if I need to save data in sheet 2 from sheet 1 and avoid duplicate entries in sheet 2, where I need to compile my data
@muhammadmunir4068
@muhammadmunir4068 2 года назад
Respected sir your code is working well when I put duplicate data and press ENTER. But when i move to other cell through arrow keys it does not works.Secondly when we move to previous cell its row also deleted even it is happen to be unique value. Please advise how to fix this issue
@broudjzed7892
@broudjzed7892 10 дней назад
Hello boss how to update database once by transfering all listbox items once tanks
@sallytong241
@sallytong241 3 года назад
If it is possible the final action is not deleting the last row, but go to the number that has previously been entered. For example, if it is not ID number, it is fax number, I do not want to type duplicated fax number.
@ExcelDestination
@ExcelDestination 3 года назад
for that, I would suggest, you should use search and update feature using vba code.
@sallytong241
@sallytong241 3 года назад
@@ExcelDestination Thank you
@alializadeh8195
@alializadeh8195 Год назад
Thank man
@ranjanbirla5554
@ranjanbirla5554 3 года назад
This code has an issue if you move up in column four (04), It will show it is a duplicate record and delete it. You keep moving the cursor in the upper row and it will keep deleting records. Which should not be the case.
@ExcelDestination
@ExcelDestination 3 года назад
this code is to prevent duplicates only. if you need any vba code support, please share your requirement at exceldestination@gmail.com
@shruthinagappan2678
@shruthinagappan2678 2 года назад
Exactly
@曾文東-x5d
@曾文東-x5d 4 года назад
Where to find the exercise file?
@robertgryska3954
@robertgryska3954 4 года назад
Hi I have problem with this line lastrow = Worksheets("Sheet1").Cells(Rows.Count, 4).End(x1Up).Row - Runtime error 1004 application defined or object defined error. Thx
@alsaadventure8501
@alsaadventure8501 3 года назад
XLup not x1up Cmiiw
@markarvin7725
@markarvin7725 5 лет назад
📢 This is nice, but there's a problem. If you mistakenly click on an entry that you don't want deleted, it automatically deletes that entry. Is there a fix out there for this? 😃
@michaelsmits8677
@michaelsmits8677 4 года назад
why not use a mesbox yes/no to first confirm your action? That would help I guess
@sureshsomaiya3820
@sureshsomaiya3820 4 года назад
Thanks bhai
@ExcelDestination
@ExcelDestination 4 года назад
YW
@mukundpotdar9849
@mukundpotdar9849 5 лет назад
Hi In case if user try to copy and paste the data from Row 1 of Customer Id to Row 16 of Customer Id. Can we prevent the duplicate data.
@ExcelDestination
@ExcelDestination 5 лет назад
Thanks for your question...I haven't tried it while developing this code...will try and let you know.
@giuseppegenovese4747
@giuseppegenovese4747 5 лет назад
Enter this code and adapt it to the need to do wath you asked for Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim nr As Variant If ActiveCell.Column = 3 And ActiveCell.Offset(1, 0).Value = "" Then nr = Worksheets("Foglio17").Range("c" & Rows.Count).End(xlUp).Value lastrow = Worksheets("Foglio17").Cells(Rows.Count, 3).End(xlUp).Row For i = 2 To lastrow - 1 If nr = Worksheets("Foglio17").Cells(i, 3).Value Then Worksheets("Foglio17").Cells(lastrow, 3).ClearContents MsgBox ("Numberr already present please rewrite it"), vbInformation Worksheets("Foglio17").Cells(lastrow, 3).Select End If Next i End If End Sub
@mukundpotdar9849
@mukundpotdar9849 5 лет назад
Thank you, Its Working
@luissoler9769
@luissoler9769 4 года назад
@@giuseppegenovese4747 Ciao! I've tried this code but when i go to the last cell in the sheet or i have an error i got a massagger with error 13 or error 1004
@Quoteminds5
@Quoteminds5 4 года назад
Hello , let say we have a id 12 and u right again in the below 12 , then it shows duplicate and delete the cell which is great , but when u enter again in blank cell the above data gets deleted also please advise
@ExcelDestination
@ExcelDestination 4 года назад
you can choose any other column, except id.
@Quoteminds5
@Quoteminds5 4 года назад
@@ExcelDestination you can choose another column normally , but whats happening if u write id 12 and then press enter it goes to cell 13 , ( which should be id number 13 entered ) but if u leave it blank and press enter again it deletes row 12
@Quoteminds5
@Quoteminds5 4 года назад
@@ExcelDestination yes but i want in the id column to not except duplicates and at the same time move down in the empty cells, 2- the rows I'm working with have colors in them , but them i press the command button to copy the rows , the rows copies perfectly as the data specified but the colors of the cells change " is there any vba code to keep the colors the same "
@crazy2242
@crazy2242 3 года назад
@@ExcelDestination Is there a better way to not delete the cell for that id? What if i select that id column and when i press up, it accidentally deletes the important data one by one?
@hazemali382
@hazemali382 4 года назад
Great
@jooste
@jooste Год назад
Start @ 2:54
Далее
Prevent Duplicate Entries in Excel (2 Simple Ways)
6:53
10X Your Excel with Macros & Basic VBA
11:18
Просмотров 86 тыс.
The Ultimate Guide to Copying Data using Excel VBA
31:05
Listbox Prevent Duplicate Entry Userform Excel VBA
15:31
Copy Filtered Data To New Sheets Excel VBA Macro
5:03