Function NumToString(V) As String
Dim N As String
For i = 1 To Len(V)
If Mid(V, i, 1) = "." And N <> "" And Not CBool(InStr(N, ".")) Then
N = N & Mid(V, i, 1)
Else
If IsNumeric(Mid(V, i, 1)) Then
N = N & Mid(V, i, 1)
Else
If N <> "" Then
NumToString = NumToString & Format(Val(Replace(N, ",", ".")), String(13, "0") & "." & String(13, "0"))
N = ""
End If
NumToString = NumToString & Mid(V, i, 1)
End If
End If
Next
If N <> "" Then
NumToString = NumToString & Format(Val(Replace(N, ",", ".")), String(13, "0") & "." & String(13, "0"))
End If
End Function
Sub test()
With ThisWorkbook
For i = 2 To .Sheets.Count
If NumToString(.Sheets(i).Name) < NumToString(.Sheets(i - 1).Name) Then
.Sheets(i).Move Before:=.Sheets(i - 1)
i = i - 2
End If
If i < 1 Then i = 1
Next
End With
End Sub
Sub a()
Debug.Print NumToString("PK 10.4") < NumToString("PK 10.041.")
End Sub