|
- Sub ykcbf() '//2025.3.26 '//按字串中最后5位数字排序
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- On Error Resume Next
- Set sh = ThisWorkbook.Sheets("Sheet1")
- With Sheets("Sheet1")
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 2)
- For i = 1 To UBound(arr)
- arr(i, 2) = Right(arr(i, 1), 5) * 1
- Next
- End With
- Set sht = ThisWorkbook.Worksheets.Add
- With sht
- Set Rng = .[a1].Resize(UBound(arr), UBound(arr, 2))
- .Columns(1).NumberFormatLocal = "@"
- Rng.Value = arr
- Rng.Sort Rng.Columns(2), 1, Orientation:=1
- arr = Rng.Value
- End With
- sht.Delete
- sh.Columns(1).NumberFormatLocal = "@"
- sh.[a1].Resize(r, 1) = arr
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|