Private Sub Command1_Click()
Dim lsTemp As String
Dim llCount As Long
Dim lsOut As String
Dim lsMax As String
lsTemp = InputBox("请输入要排序的数字")
If Not CBool(StrPtr(lsTemp)) Then
MsgBox "你按的是取消,怎么排序阿?"
Exit Sub
Else
Do While Len(lsTemp) > 0
lsMax = ""
For llCount = 1 To Len(lsTemp)
If lsMax <= Mid(lsTemp, llCount, 1) Then
lsMax = Mid(lsTemp, llCount, 1)
End If
Next
lsOut = lsOut & String(Len(lsTemp) - Len(Replace(lsTemp, lsMax, "")), "" & lsMax & "")
lsTemp = Replace(lsTemp, lsMax, "")
Loop
End If
MsgBox lsOut
End Sub