Sub test0()
Dim ar, i As Long
ar = Range("M5", Cells(Rows.Count, "A").End(xlUp)) '多取一列,存放时间
For i = 1 To UBound(ar)
ar(i, UBound(ar, 2)) = CDate(Replace(ar(i, 3), ".", "/"))
Next
With CreateObject("Excel.Sheet")
With .Worksheets(1).Range("A1").Resize(UBound(ar), UBound(ar, 2))
.Value = ar
.Sort .Item(UBound(ar, 2)), xlAscending, , , , , , xlNo
With .Columns(2)
.Sort .Item(1), xlAscending, , , , , , xlNo
End With
ar = .Value
End With
.Close
End With
Range("A5").Resize(UBound(ar), UBound(ar, 2) - 1) = ar
End Sub |