Tuesday, 26 March 2013

How to Remove Duplicates from Multiple Columns using Excel VBA Macro

Excel Macro To Remove Duplicates from Each Column In a Active Sheet
Sub Remove_Dups_In_All_Columns()
Dim X As Integer
Dim Y As Integer
Dim CC As Long
Dim DC As Integer

DC = 0

CC = ActiveSheet.Columns.count

For X = 1 To CC 'Count of All Columns In Active Sheet
If Cells(1, X) = "" Then Exit For
DC = DC + 1 'Data Columns Count In Active Sheet
Next X

For Y = 1 To DC

ActiveSheet.Cells(1, Y).EntireColumn.Select
Selection.RemoveDuplicates Columns:=1, Header:=xlYes
Next Y

End Sub


Thanks,

TAMATAM



No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts