I am trying to use a macro to delete all duplicate rows. I found the below in a google search but it definitely does not delete all rows.
For example, I have the below table and there are quite a lot of duplicates.
VBA Code:
Sub Delete_Duplicate_Rows_Based_on_All_Columns()
Dim MyRng As Range
Dim MainColumns As Variant
Set MyRng = Range("A2:C1000")
AllColumns = MyRng.Columns.Count
ReDim MainColumns(0 To AllColumns - 1)
For i = 0 To AllColumns - 1
MainColumns(i) = i + 1
Next i
MyRng.RemoveDuplicates Columns:=(MainColumns), Header:=xlYes
End Sub
For example, I have the below table and there are quite a lot of duplicates.
A | B | C |
ITEM_NO | DIM_2_UPPER | DIM_2 |
38518 | S | S |
38518 | M | M |
38518 | L | L |
38518 | XL | XL |
38518 | XXL | XXL |
38518 | S | S |
38518 | S | S |
38518 | M | M |
38518 | L | L |
38518 | XL | XL |
38504 | XXL | XXL |
38504 | S | S |
38504 | M | M |
38504 | L | L |
38504 | XL | XL |
38504 | XXL | XXL |
38504 | S | S |
38504 | M | M |
38504 | L | L |
38504 | XL | XL |
38504 | XXL | XXL |
38504 | XS | XS |
38504 | S | S |
38504 | M | M |
38504 | L | L |