Good morning,

I have a slight problem with one of my macros, and was wondering if anyone has an obvious answer as to why this is.

I have data in columns A till H, with column G containing dates. I am trying to sort the data according to the dates in descending order. When I select the data and use Data - Sort, it works. However, when I record a macro and do the same thing, when I run the macro, it does not sort properly. Instead, it sorts the column as text. In other words 30/01/08 appears above 01/06/08 instead of below.

Range("A3").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Sort Key1:=Range("G4"), Order1:=xlDescending, Header:=xlGuess, _
        OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
        DataOption1:=xlSortTextAsNumbers
Having found out the column is indeed formatted as text, I then added a line to the macro to convert the column to dates instead of text, but this still doesn't work.

I have tried the same thing using auto filter -sort descending- and again it works when I do it manually, but not when I record and run a macro. Anybody have any idea why this is or what I am doing wrong?