我有一个带有“自动过滤器”和“标题”行的动态表,每天在倒数第二列中添加昨天的数据。最后一列具有最近2天的数据差异。我需要将具有倒数第二天的完整表格作为升序的排序键进行排序。请帮助完成以下代码。
lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
lastColumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Set rngData = ActiveSheet.Cells(1, 1).Resize(lastRow, lastColumn)
ActiveWorkbook.Worksheets("All_LAC").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("All_LAC").Sort.SortFields.Add_
Key:=lastColumn-1, SortOn:=xlSortOnValues, Order:=xlAscending,_
DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("All_LAC").Sort
.SetRange rngData
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With