请问怎么排序?怎么修改这段VBA代码?
有人在Excel做了个自定义函数,可以达到此结果,在狐表怎么做,附上excel自定义
Public Function px(rng As Range)
If rng.Count <> 1 Then px = "err": Exit Function
Dim tempstr() As String
tempstr = Split(rng.Value, " ")
Dim cont As Integer, tempv As String, returnv As String
If UBound(tempstr) >= 0 Then cont = UBound(tempstr) + 1
If cont > 0 Then
cont = cont - 1
For i = 0 To cont - 1
For j = i + 1 To cont
If tempstr(j) < tempstr(i) Then
tempv = tempstr(j)
tempstr(j) = tempstr(i)
tempstr(i) = tempv
End If
Next
Next
i = 0
For i = 0 To cont
If i = 0 Then
returnv = tempstr(i)
Else
returnv = returnv & " " & tempstr(i)
End If
Next
End If
px = returnv
End Function
此主题相关图片如下:排序.jpg