Hi,
I am making a macro in excel to sort a column by dates. The dates have the following format dd/mm/yy. This is the code I use:
Problem is it sorts the dates as numbers not dates. Can anyone help me out here?
I am making a macro in excel to sort a column by dates. The dates have the following format dd/mm/yy. This is the code I use:
Code:
Sub SortByBestilt()
Range("B10:O65536").Select
'Header to sort after
Selection.Sort Key1:=Range("H10"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortDate
End Sub
Problem is it sorts the dates as numbers not dates. Can anyone help me out here?