Dim first As Integer
Dim second As Integer
Dim heights As Integer

Dim result As Single

Private Sub Command1_Click()
If Val(Text4) = ((first + second) / 2) * heights Then
    Print MsgBox("Correct")
Else: Print MsgBox("Incorrect")
End If
End Sub

Private Sub Command2_Click()
Randomize
first = (20 * Rnd + 1)
second = (10 * Rnd + 1)
heights = (10 * Rnd + 1)

Text1.Text = first
Text2.Text = second
Text3.Text = heights

End Sub

Private Sub Command3_Click()
Calculator.Show
End Sub

Private Sub Command4_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
End Sub

    Source: geocities.com/matkins70