我有一个脚本:
Sub wsPOT()
Dim wsPOT As Worksheet
Dim cel As Range
Dim lastrow As Long, lastrow2 As Long, fstcell As Long, i As Long, Er As Long, lstCol As Long, lstRow As Long
Set wsPOT = Sheets("PO Tracking")
With wsPOT
wsPOT.Range("Q1:U1").Copy
lastrow = wsPOT.Cells(Rows.Count, "B").End(xlUp).Row
wsPOT.Range("V1:X1").Copy wsPOT.Range("H3:J" & lastrow)
wsPOT.Range("N2:O2").Copy wsPOT.Range("N3:O" & lastrow)
wsPOT.Range("P1:V1").Copy
wsPOT.Range("B3:H" & lastrow).PasteSpecial xlPasteFormats
wsPOT.Range("K3:K" & lastrow).Borders.Weight = xlThin
lastrow = wsPOT.Cells(Rows.Count, "B").End(xlUp).Row
wsPOT.Range("H:J").Calculate
wsPOT.Range("B3:K" & lastrow).Sort key1:=Range("H3:H" & lastrow), order1:=xlAscending
lastrow2 = wsPOT.Cells(Rows.Count, "H").End(xlUp).Row
wsPOT.Range("B3:K" & lastrow2).Sort key1:=Range("H3:H" & lastrow2), order1:=xlDescending
End With
End Sub
这是为了最终组织工作表,使迟到的工作排在最前面,然后按从大到小排列。
它似乎不起作用。似乎发生的是第一个组织工作正常,但它似乎忽略了第二个标准。
附件是表格,带有脚本。
https://dl.dropbox.com/u/3327208/Excel/Orga.xlsm
如果有人可以帮助看看这个,它会受到赞赏。