This Excel VBA procedure will remove all of the duplicate values in multiple columns. Since Excel 2010 we have been able to remove the duplicates in a column. With the assistance of VBA we can automate this task to remove all of the duplicates in all of the columns or you can choose which columns to remove the duplicate values from.
The following is the Excel VBA code which remove all duplicates in all of the columns of a particular sheet.
Option Explicit
Sub DeDupeCols()
Dim rng As Range
Dim i As Integer
Dim Cols As Variant
Set rng = [A1].CurrentRegion
ReDim cols(0 To rng.Columns.Count - 1)
For i=0 To UBound (cols) 'Loop for all columns
cols(i)=i + 1
Next i
rng.RemoveDuplicates Columns:=(cols), Header:=xlYes
End Sub
As I have used the current region I have made the assumption that headers are on the top row (fair assumption as this is where they should be) . If for some new age reason you do not have headers then remove the last part.
If you wanted to remove the duplicates in say columns (1, 2, 3) then the following would help.
Option Explicit
Sub DeDupeColSpecific()
Cells.RemoveDuplicates Columns:=Array(1, 2, 3), Header:=xlYes
End Sub
Change the columns to suit - ie. 1, 2, 3 becomes the columns you are interested in deleting.