Tuesday, March 26, 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

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog