I thought it would be easy to run the Macro recorder.
First record a Sort. Then record the AdvancedFilter on Unique items.
Triggered both Macros by a Worksheet Change event.
Problems:
1. Sort Only works with a 1 (number or text) in the first position - under INPUT (B5:B16)
2. FilterUnique don't filter the above 1, leaving two 1's - under OUTPUT (C5)
What am I missing?
Ola
Example file attached
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Myrange As Range
Range("B5:B16").Name = "Myrange"
Sort
FilterUnique
End Sub
-------------------
Sub Sort()
Range("Myrange").Sort _
Key1:=Range("B5"), _
Order1:=xlAscending, _
Header:=xlGuess, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
End Sub
--------------------
Sub FilterUnique()
Range("Myrange").AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Range("C5"), _
Unique:=True
End Sub
Bookmarks