How can I sort dates in an array in vba?

前端 未结 2 1124
逝去的感伤
逝去的感伤 2020-12-19 09:54

Hi I am new to programming and just started learning VBA for excel. I have a query regarding sorting of arrays. How do I sort an array containing dates? For example if I hav

2条回答
  •  孤城傲影
    2020-12-19 10:39

    This might help. fell free to ask a follow up question.

    Sub Sort()
    Dim x As Long, y As Long, z As Long
        For x = Application.WorksheetFunction.Min(Columns("M")) To Application.WorksheetFunction.Max(Columns("M"))
            For y = 1 To Worksheets("Users Info").Cells(Rows.Count, 13).End(xlUp).Row
            If Worksheets("Users Info").Cells(y, 13).Value = i Then
                z = z + 1
                Worksheets("Users Info").Cells(z, 14).Value = i
            End If
            Next y
        Next x
    End Sub
    

提交回复
热议问题