Hi
I have a worksheet which includes a column of dates as strings in the format of yyyymmdd.
My vba prog:
1. set the column to "Text":
Columns(c).NumberFormat = "@"
2. change each date to "dd/mm/yyyy" format
3. set the column to date format:
Columns(c).NumberFormat = "dd/mm/yyyy;@"
I have also tried "dd/mm/yyyy"
At this point if I use Excel to Sort Ascending by this column, the data is correctly sorted in date order.
But this following vba sorts the data as if it were text:
myWorksheet.Range("A1").CurrentRegion.Sort Key1:=Cells(2, 7), _ Order1:=xlAscending, Header:=xlYes, Orientation:=xlTopToBottom
Any idea why? and how I would get it to sort correctly?
Thanks
Mike