Unique Output is Duplicating minimum date value

G

Guest

I have 8 dates in a Range A2:A9 (A1 is header) like so,, (4 are unique)

MyDates
12/31/2006
1/25/2007
12/31/2006
1/15/2007
1/15/2007
12/31/2006
1/25/2007
2/15/2007


Sub Macro5()
'
' Macro5 Macro
' Macro recorded 8/21/2007 by Jim May
'
ActiveCell.Range("A1:A9").Select
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
ActiveCell.Offset(1, 0).Range("A1:A8").AdvancedFilter
Action:=xlFilterCopy, _
CopyToRange:=ActiveCell.Offset(1, 2).Range("A1"), Unique:=True
End Sub

The Above produces:

12/31/2006 << need to eliminate this guy obviously - but how?
12/31/2006
1/15/2007
01/25/2007
2/15/2007
 
G

Guest

Jim,

Try this

Sub Macro5()
ActiveCell.Range("A2:A9").Select
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending
Range("A1:A10").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("C1"), Unique:=True
End Sub

Mike
 
G

Guest

Mike - Thanks !!

Mike H said:
Jim,

Try this

Sub Macro5()
ActiveCell.Range("A2:A9").Select
Selection.Sort Key1:=ActiveCell, Order1:=xlAscending
Range("A1:A10").AdvancedFilter Action:=xlFilterCopy,
CopyToRange:=Range("C1"), Unique:=True
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top