We generally come across situation where we want to list Unique rows (for ranges having more than one column) or Unique cells (for ranges having one column).
Here is the Simple Macro for that.
Sub AdvancedFilter()
'Declaring Variables
Dim Des As Range 'Destination Variable
Dim Sou As Range 'Source Variable
Set Des = Range("G1") 'Set Destination Cell here
Des.CurrentRegion.ClearContents 'Clearing Previous Content
Set Sou = Range("A1").CurrentRegion.EntireColumn 'Set Source Range here
'Using Advanced filter
Sou.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Des, _
Unique:=True
Des.CurrentRegion.EntireColumn.SpecialCells(4).Delete 'Removing Empty rows
End Sub
Check the attached example file for instructions:-
Regards,
Vikas Gautam
Comments
Post a Comment