Below code is counting a final amount of students in a school and average amount of students in a class.
It's running the code until the user types "0".
How can I ensure that the "0 class" won't be counted as an additional class? Currently I am achieving it by subtracting -1 from B, but it's not an elegant solution - calculation is correct, but the class is still listed in final MsgBox.
Btw, if I wanted to end the loop when user is leaving the cell empty, what should I do? Simple Loop Until Zak = "" doesn't work.
Many thanks,
Sub D1()
    Dim Zak As Byte
    Dim B As Byte, C As Byte
    Dim kzak As String
    Dim ktrid
    Dim trid As Byte
    Dim k, l As Integer
    B = 0
    kzak = ""
    Do
        Zak = InputBox("Amount of students")
        B = B + 1
        kzak = kzak & Str(B) & (" class") & ("            ") & _
            ("Students ") & Str(Zak) & Chr(10)
        k = k + Zak
    Loop Until Zak = 0
    C = (B - 1)
    l = k / C
    MsgBox kzak & Chr(10) & ("At school is ") & Str(k) & (" students") & _
        (", on avarage ") & Str(l) & (" in a class")
End Sub
 
     
     
    