|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 先排字母后排数字()
- Application.ScreenUpdating = False
- Dim arr, brr, s$, a, b, i, k, n
- arr = Range("a1", [a65536].End(3))
- brr = arr
- For i = 1 To UBound(arr)
- s = arr(i, 1)
- For n = 1 To Len(arr(i, 1))
- If IsNumeric(Mid(s, n, 1)) Then
- a = Left(s, n - 1)
- b = Mid(s, n) + 1000000
- Exit For
- End If
- Next
- k = 3 - Len(a)
- brr(i, 1) = a & String(k, "@") & b & "$" & s
- Next
- [h1].Resize(UBound(arr)) = brr
- [h1].Resize(UBound(arr)).Sort [h1], 1
- [h1].Resize(UBound(arr)).Replace "*$", ""
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|