|
- Sub ykcbf() '//2025.3.14 排序
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Set sh = ThisWorkbook.Sheets("班级成绩对比表")
- With sh
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .Range("a2:n" & r)
- End With
- For i = 1 To UBound(arr)
- st = Split(arr(i, 12), "-")
- arr(i, 13) = st(0)
- arr(i, 14) = st(1)
- Next
- Set sht = ThisWorkbook.Worksheets.Add
- With sht
- .Name = "TempSheet"
- Set Rng = .Range("a1:n" & r - 1)
- Rng.Value = arr
- With Rng
- .Parent.Sort.SortFields.Clear
- .Sort key1:=.Item(13), order1:=1, key2:=.Item(14), order2:=1, Header:=2
- End With
- arr = Rng.Value
- End With
- sht.Delete
- sh.Range("a2:l" & r) = arr
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码
|
|