|
- Sub test()
- Dim r%, i%
- Dim arr, brr()
- With Worksheets(1)
- .AutoFilterMode = False
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- c = .Cells(1, .Columns.Count).End(xlToLeft).Column
- arr = .Range("c2:c" & r)
- ReDim brr(1 To UBound(arr), 1 To 1)
- For i = 1 To UBound(arr)
- If InStr(arr(i, 1), "-") = 0 Then
- brr(i, 1) = 10 ^ 6
- Else
- xm = Split(arr(i, 1), "-")
- brr(i, 1) = Val(xm(0)) * 10 ^ 3 + Val(xm(1))
- End If
- Next
- .Cells(2, c + 1).Resize(UBound(brr), UBound(brr, 2)) = brr
- .Range("a2").Resize(r - 1, c + 1).Sort key1:=.Cells(2, c + 1), order1:=xlAscending, Header:=xlNo
- .Columns(c + 1).Clear
- End With
- End Sub
复制代码 |
|