Private Sub Command1_Click() Dim T As String Dim K() As String Dim I As Long Dim S As Long
T = "123456789"
Loop100:
ReDim K(Len(T) - 1) For I = 0 To Len(T) - 1 K(I) = Mid(T, I + 1, 1) Next S = 0 For I = 0 To UBound(K) S = S + K(I) Next If S > 10 Then T = CStr(S) GoTo Loop100 End If
Dim T As String
Dim K() As String
Dim I As Long
Dim S As Long
T = "123456789"
Loop100:
ReDim K(Len(T) - 1)
For I = 0 To Len(T) - 1
K(I) = Mid(T, I + 1, 1)
Next
S = 0
For I = 0 To UBound(K)
S = S + K(I)
Next
If S > 10 Then
T = CStr(S)
GoTo Loop100
End If
MsgBox S
End Sub