#### Topic: Error in the program code "End if without block if" in VBA Excel

Hello, I study at university and set the job "the quadratic equation Decision ax2+bx+c=0. In the program consider all possible checks and :A=0; B=0; C=0; A=b=0; A=c=0; A=c=0" through the form in VBA Excel.
More low attached a screen with the form as it looks. The code is written for button "Account". When I push the button produces an error in VBA "End if without block if", as though I did not try to correct, all the same somewhere it appears. Stopped on this variant of the code. Red marked where the program stops and produces an error. Therefore ask help from you how to correct and probably somehow to add the code that it regularly worked. If any additional information is necessary write I will attach further in a subject. In advance thanks for answers and the help.

``````Private Sub CommandButton1_Click ()
If Not IsNumeric (TextBox1) Or Not IsNumeric (TextBox2) Or Not IsNumeric (TextBox3) Then
MsgBox "the Initial data is entered incorrectly or not completely!", "Enter numbers"
Exit Sub
Else
a = CDbl (TextBox1)
b = CDbl (TextBox2)
c = CDbl (TextBox3)
End If
If (a = 0 And b = 0) Or (D &lt;0) Then
MsgBox "Roots are not present"
Exit Sub
End If
If (a = 0 And c = 0) Or (b = 0 And c = 0) Then
TextBox5 = "0"
Exit Sub
End If
If a = 0 Then
If b &lt;&gt; 0 Then
TextBox5 =-c / b
Else
MsgBox "it is impossible to divide Into a zero!"
Exit Sub
End If
End If
If b = 0 Then
If a = 0 Then MsgBox "it is impossible to divide Into a zero!"
Exit Sub
Else
If-c / a &lt;0 Then
MsgBox "It is impossible to derive a root from a negative number"
Exit Sub
Else
If a = 0 Then
MsgBox "it is impossible to divide Into a zero!"
Exit Sub
Else
TextBox5 = Sqr (-c / a) And TextBox6 =-Sqr (-c / a)
End If
End If
End If
&gt;&gt;&gt; End If &lt;&lt;&lt;
If with = 0 Then
If a &lt;&gt; 0 Then
TextBox5 = "0" And TextBox6 =-b / a
Else: MsgBox "it is impossible to divide Into a zero!"
Exit Sub
End If
End If
D = (b) ^ 2 *-4 * a * c
If a &lt;&gt; 0 And b &lt;&gt; 0 And c &lt;&gt; 0 Then
TextBox5 = (-b + Sqr (D)) / 2 * an And TextBox6 = (-b - Sqr (D)) / 2 * a
Else
MsgBox "it is impossible to divide Into a zero!"
Exit Sub
End If
End Sub``````

[img=https://ibb.co/g1QEhw]

#### Re: Error in the program code "End if without block if" in VBA Excel

1) At university did not learn to put indents for lines when you plunge into a cycle or a condition?
Deliver indents, the error at once will be visible
2) At university did not give syntax if for VB?

``If condition Then the operator``

and

``````If condition Then
The operator
End If``````

It is different  and it cannot be mixed

#### Re: Error in the program code "End if without block if" in VBA Excel

Thanks big, no, unfortunately at university did not learn, as the computer science goes as the minor subject and school hours on it is given a little. As you advised to find easier and easier really where was mistaken, once again many thanks)