Private Sub CommandButton1_Click()
Dim s As Integer, z As Integer
Dim t As String
t = "Для оплате в кассе необходимы:"
s = CInt(InputBox("Введите сумму оплаты"))
Do While s > 0
If s >= 500 Then
s = s - 500: k = k + 1
ElseIf s >= 200 Then
s = s - 200: m = m + 1
ElseIf s >= 100 Then
s = s - 100: n = n + 1
ElseIf s >= 50 Then
s = s - 50: z = z + 1
ElseIf s >= 10 Then
s = s - 10: v = v + 1
ElseIf s >= 5 Then
s = s - 5: h = h + 1
ElseIf s >= 2 Then
s = s - 2: f = f + 1
ElseIf s >= 1 Then
s = s - 1: d = d + 1
End If
Loop
If k > 0 Then
t = t + " " & k & " по 500 рублей, "
t = t + " " & m & " по 200 рублей, "
t = t + " " & n & " по 100 рублей, "
t = t + " " & z & " по 50 рублей, "
t = t + " " & v & " по 10 рублей, "
t = t + " " & h & " по 5 рублей, "
t = t + " " & f & " по 2 рублей, "
t = t + " " & d & " по 1 рублей, "
Cells(10, 1) = t
End Sub
Private Sub CommandButton1_Click()
Dim s As Integer, z As Integer
Dim t As String
t = "Для оплате в кассе необходимы:"
s = CInt(InputBox("Введите сумму оплаты"))
Do While s > 0
If s >= 500 Then
s = s - 500: k = k + 1
ElseIf s >= 200 Then
s = s - 200: m = m + 1
ElseIf s >= 100 Then
s = s - 100: n = n + 1
ElseIf s >= 50 Then
s = s - 50: z = z + 1
ElseIf s >= 10 Then
s = s - 10: v = v + 1
ElseIf s >= 5 Then
s = s - 5: h = h + 1
ElseIf s >= 2 Then
s = s - 2: f = f + 1
ElseIf s >= 1 Then
s = s - 1: d = d + 1
End If
Loop
If k > 0 Then
t = t + " " & k & " по 500 рублей, "
t = t + " " & m & " по 200 рублей, "
t = t + " " & n & " по 100 рублей, "
t = t + " " & z & " по 50 рублей, "
t = t + " " & v & " по 10 рублей, "
t = t + " " & h & " по 5 рублей, "
t = t + " " & f & " по 2 рублей, "
t = t + " " & d & " по 1 рублей, "
Cells(10, 1) = t
End If
End Sub