J jack999 Member Aug 18, 2015 #1 I have an excel file with Product ID and Description Column. I want a macro to find out the Duplicate entries in that sheet. Herewith I attached a sample file. Attachments sample.xlsx 8.6 KB · Views: 0
I have an excel file with Product ID and Description Column. I want a macro to find out the Duplicate entries in that sheet. Herewith I attached a sample file.
YasserKhalil Well-Known Member Aug 18, 2015 #2 Select the range("A3:B24") Go to Data in the ribbon > Click Remove Duplicates In VBA Code: Sub Test() Range("A2:B" & Cells(Rows.Count, 1).End(3).Row).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes End Sub
Select the range("A3:B24") Go to Data in the ribbon > Click Remove Duplicates In VBA Code: Sub Test() Range("A2:B" & Cells(Rows.Count, 1).End(3).Row).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes End Sub
J jack999 Member Aug 18, 2015 #3 YasserKhalil said: Select the range("A3:B24") Go to Data in the ribbon > Click Remove Duplicates In VBA Code: Sub Test() Range("A2:B" & Cells(Rows.Count, 1).End(3).Row).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes End Sub Click to expand... If my file has 14 – 15 columns and its range start from B6 what changes will come in this code. Can you explain this code - Cells(Rows.Count, 1).End(3).Row) and Columns:=Array(1, 2), New file attached Attachments sample1.xlsm 19.1 KB · Views: 1
YasserKhalil said: Select the range("A3:B24") Go to Data in the ribbon > Click Remove Duplicates In VBA Code: Sub Test() Range("A2:B" & Cells(Rows.Count, 1).End(3).Row).RemoveDuplicates Columns:=Array(1, 2), Header:=xlYes End Sub Click to expand... If my file has 14 – 15 columns and its range start from B6 what changes will come in this code. Can you explain this code - Cells(Rows.Count, 1).End(3).Row) and Columns:=Array(1, 2), New file attached
YasserKhalil Well-Known Member Aug 18, 2015 #4 Try this Code: Sub Test() Range("B7:N" & Cells(Rows.Count, "B").End(3).Row).RemoveDuplicates End Sub Columns:=Array(2, 3), Header:=xlYes This part (Cells(Rows.Count, "B").End(3).Row) refers to the last row in column B
Try this Code: Sub Test() Range("B7:N" & Cells(Rows.Count, "B").End(3).Row).RemoveDuplicates End Sub Columns:=Array(2, 3), Header:=xlYes This part (Cells(Rows.Count, "B").End(3).Row) refers to the last row in column B