excel 使用VBA从最新到最旧对列排序 | 您所在的位置:网站首页 › excelvba排序 › excel 使用VBA从最新到最旧对列排序 |
我目前正在做一个项目,我希望有一个按钮来完成Excel中的一系列步骤,以便将其放在合适的位置进行上传。我被困在排序阶段。我需要在完成筛选,删除,删除筛选步骤后,在日期列中按最新到最旧对数据进行排序。我是VBA的新手,这是我承担的第一个任务,所以它可能是我错过的非常简单的东西。 这是当前代码: Sub All_Steps () 'Filters Closed Incomplete and Closed Skipped within the state column Worksheets("Update Template").Range("A1:E15000").AutoFilter Field:=5, Criteria1:="Closed Incomplete", Operator:=xlOr, Criteria2:="Closed Skipped" 'Deletes Closed Incomplete and Closed Skipped filtered rows Application.DisplayAlerts = False Worksheets("Update Template").Range("A2:E15000").SpecialCells(xlCellTypeVisible).Delete Application.DisplayAlerts = True 'Removes filter Worksheets("Update Template").ShowAllData 'Updates DD-MM-YYYY HH:MM:SS date format to permissible DD/MM/YYY Worksheets("Update Template").Range("D2:D30000").NumberFormat = "DD/MM/YYY" End Sub我尝试过的排序代码是: Worksheets("Update Template").Range("A1:E15000", Range("A1:E15000").End(xlDown)).Sort Key1:=Range("D1"), Order1:=xlAscending, Header:=xlYes |
CopyRight 2018-2019 实验室设备网 版权所有 |