Sub ball()
Dim dt As Double
Dim ux As Double
Dim uy As Double
Dim ay As Double
Dim y_1 As Double
Dim c As Integer
Dim t As Double
Dim sx As Double
Dim sy As Double
Dim Start As Double
' Application.ScreenUpdating = True
dt = Worksheets("ball").Cells(10, 3).Value
ux = Worksheets("ball").Cells(11, 3).Value
uy = Worksheets("ball").Cells(12, 3).Value
ay = Worksheets("ball").Cells(4, 3).Value
y_1 = Worksheets("ball").Cells(3, 3).Value
For c = 0 To 200
t = c * dt
sx = ux * t
sy = y_1 + uy * t + 0.5 * ay * t ^ 2
'For cc = 1 To 10 ^ 6
'Next
Start = Timer
Do
Loop Until (Timer - Start) > 0.02
Application.ScreenUpdating = True
Worksheets("ball").Cells(16, 9).Value = sx
Worksheets("ball").Cells(16, 10).Value = sy
Next
End Sub
Global zzz As Variant
Global flag As Variant
Sub reset()
Sheets("q1").Select
protectionOFF
Worksheets("q1").Cells(12, 7).Value = 0
Worksheets("q1").Cells(10, 7).Value = 0
Worksheets("q1").Cells(4, 6).Value = " "
Worksheets("q1").Cells(4, 8).Value = " "
Worksheets("q1").Cells(5, 8).Value = " "
protectionON
Sheets("q2").Select
protectionOFF
Worksheets("q2").Cells(12, 7).Value = 0
Worksheets("q2").Cells(10, 7).Value = 0
Worksheets("q2").Cells(4, 6).Value = " "
Worksheets("q2").Cells(4, 8).Value = " "
Worksheets("q2").Cells(5, 8).Value = " "
protectionON
Sheets("q3").Select
protectionOFF
Worksheets("q3").Cells(12, 7).Value = 0
Worksheets("q3").Cells(10, 7).Value = 0
Worksheets("q3").Cells(4, 6).Value = " "
Worksheets("q3").Cells(4, 8).Value = " "
Worksheets("q3").Cells(5, 8).Value = " "
protectionON
Sheets("q4").Select
protectionOFF
Worksheets("q4").Cells(12, 7).Value = 0
Worksheets("q4").Cells(10, 7).Value = 0
Worksheets("q4").Cells(4, 6).Value = " "
Worksheets("q4").Cells(4, 8).Value = " "
Worksheets("q4").Cells(5, 8).Value = " "
protectionON
Sheets("q5").Select
protectionOFF
Worksheets("q5").Cells(12, 7).Value = 0
Worksheets("q5").Cells(10, 7).Value = 0
Worksheets("q5").Cells(4, 6).Value = " "
Worksheets("q5").Cells(4, 8).Value = " "
Worksheets("q5").Cells(5, 8).Value = " "
protectionON
Sheets("q6").Select
protectionOFF
Worksheets("q6").Cells(12, 7).Value = 0
Worksheets("q6").Cells(10, 7).Value = 0
Worksheets("q6").Cells(4, 6).Value = " "
Worksheets("q6").Cells(4, 8).Value = " "
Worksheets("q6").Cells(5, 8).Value = " "
protectionON
Sheets("menu").Select
End Sub
Sub ans1()
' correct answer D
flag = Worksheets("q1").Cells(10, 7).Value
zzz = Worksheets("q1").Cells(4, 6).Value
protectionOFF
Select Case flag
Case 0
If zzz = "D" Then
Worksheets("q1").Cells(4, 8).Value = "CORRECT"
Worksheets("q1").Cells(12, 7).Value = 10
Worksheets("q1").Cells(10, 7).Value = 1
Else
Worksheets("q1").Cells(4, 8).Value = "INCORRECT - try again"
Worksheets("q1").Cells(12, 7).Value = 0
Worksheets("q1").Cells(10, 7).Value = 1
End If
Case 1
If zzz = "D" Then
Worksheets("q1").Cells(4, 8).Value = "CORRECT"
Worksheets("q1").Cells(12, 7).Value = 5
Worksheets("q1").Cells(10, 7).Value = 2
Else
Worksheets("q1").Cells(4, 8).Value = "IN CORRECT - no more attempts"
Worksheets("q1").Cells(5, 8).Value = "CORRECT ANSWER - D"
Worksheets("q1").Cells(12, 7).Value = 0
Worksheets("q1").Cells(10, 7).Value = 2
End If
Range("F4").Select
protectionON
End Select
End Sub
Sub protectionOFF()
ActiveSheet.ProtectDrawingObjects:=True, Contents:=False, Scenarios:=True
End Sub
Sub protectionON()
ActiveSheet.ProtectDrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Sub ans2()
' correct answer A
flag = Worksheets("q2").Cells(10, 7).Value
zzz = Worksheets("q2").Cells(4, 6).Value
protectionOFF
Select Case flag
Case 0
If zzz = "A" Then
Worksheets("q2").Cells(4, 8).Value = "CORRECT"
Worksheets("q2").Cells(12, 7).Value = 10
Worksheets("q2").Cells(10, 7).Value = 1
Else
Worksheets("q2").Cells(4, 8).Value = "INCORRECT - try again"
Worksheets("q2").Cells(12, 7).Value = 0
Worksheets("q2").Cells(10, 7).Value = 1
End If
Case 1
If zzz = "A" Then
Worksheets("q2").Cells(4, 8).Value = "CORRECT"
Worksheets("q2").Cells(12, 7).Value = 5
Worksheets("q2").Cells(10, 7).Value = 2
Else
Worksheets("q2").Cells(4, 8).Value = "IN CORRECT - no more attempts"
Worksheets("q2").Cells(5, 8).Value = "CORRECT ANSWER - A"
Worksheets("q2").Cells(12, 7).Value = 0
Worksheets("q2").Cells(10, 7).Value = 2
End If
Range("F4").Select
protectionON
End Select
End Sub
Sub ans3()
' correct answer B
flag = Worksheets("q3").Cells(10, 7).Value
zzz = Worksheets("q3").Cells(4, 6).Value
protectionOFF
Select Case flag
Case 0
If zzz = "B" Then
Worksheets("q3").Cells(4, 8).Value = "CORRECT"
Worksheets("q3").Cells(12, 7).Value = 10
Worksheets("q3").Cells(10, 7).Value = 1
Else
Worksheets("q3").Cells(4, 8).Value = "INCORRECT - try again"
Worksheets("q3").Cells(12, 7).Value = 0
Worksheets("q3").Cells(10, 7).Value = 1
End If
Case 1
If zzz = "B" Then
Worksheets("q3").Cells(4, 8).Value = "CORRECT"
Worksheets("q3").Cells(12, 7).Value = 5
Worksheets("q3").Cells(10, 7).Value = 2
Else
Worksheets("q3").Cells(4, 8).Value = "IN CORRECT - no more attempts"
Worksheets("q3").Cells(5, 8).Value = "CORRECT ANSWER - B"
Worksheets("q3").Cells(12, 7).Value = 0
Worksheets("q3").Cells(10, 7).Value = 2
End If
Range("F4").Select
protectionON
End Select
End Sub
Sub ans4()
' correct answer C
flag = Worksheets("q4").Cells(10, 7).Value
zzz = Worksheets("q4").Cells(4, 6).Value
protectionOFF
Select Case flag
Case 0
If zzz = "C" Then
Worksheets("q4").Cells(4, 8).Value = "CORRECT"
Worksheets("q4").Cells(12, 7).Value = 10
Worksheets("q4").Cells(10, 7).Value = 1
Else
Worksheets("q4").Cells(4, 8).Value = "INCORRECT - try again"
Worksheets("q4").Cells(12, 7).Value = 0
Worksheets("q4").Cells(10, 7).Value = 1
End If
Case 1
If zzz = "C" Then
Worksheets("q4").Cells(4, 8).Value = "CORRECT"
Worksheets("q4").Cells(12, 7).Value = 5
Worksheets("q4").Cells(10, 7).Value = 2
Else
Worksheets("q4").Cells(4, 8).Value = "IN CORRECT - no more attempts"
Worksheets("q4").Cells(5, 8).Value = "CORRECT ANSWER - C"
Worksheets("q4").Cells(12, 7).Value = 0
Worksheets("q4").Cells(10, 7).Value = 2
End If
Range("F4").Select
protectionON
End Select
End Sub
Sub ans5()
' correct answer A
flag = Worksheets("q5").Cells(10, 7).Value
zzz = Worksheets("q5").Cells(4, 6).Value
protectionOFF
Select Case flag
Case 0
If zzz = "A" Then
Worksheets("q5").Cells(4, 8).Value = "CORRECT"
Worksheets("q5").Cells(12, 7).Value = 10
Worksheets("q5").Cells(10, 7).Value = 1
Else
Worksheets("q5").Cells(4, 8).Value = "INCORRECT - try again"
Worksheets("q5").Cells(12, 7).Value = 0
Worksheets("q5").Cells(10, 7).Value = 1
End If
Case 1
If zzz = "A" Then
Worksheets("q5").Cells(4, 8).Value = "CORRECT"
Worksheets("q5").Cells(12, 7).Value = 5
Worksheets("q5").Cells(10, 7).Value = 2
Else
Worksheets("q5").Cells(4, 8).Value = "IN CORRECT - no more attempts"
Worksheets("q5").Cells(5, 8).Value = "CORRECT ANSWER - A"
Worksheets("q5").Cells(12, 7).Value = 0
Worksheets("q5").Cells(10, 7).Value = 2
End If
Range("F4").Select
protectionON
End Select
End Sub
Sub ans6()
' correct answer B
flag = Worksheets("q6").Cells(10, 7).Value
zzz = Worksheets("q6").Cells(4, 6).Value
protectionOFF
Select Case flag
Case 0
If zzz = "B" Then
Worksheets("q6").Cells(4, 8).Value = "CORRECT"
Worksheets("q6").Cells(12, 7).Value = 10
Worksheets("q6").Cells(10, 7).Value = 1
Else
Worksheets("q6").Cells(4, 8).Value = "INCORRECT - try again"
Worksheets("q6").Cells(12, 7).Value = 0
Worksheets("q6").Cells(10, 7).Value = 1
End If
Case 1
If zzz = "B" Then
Worksheets("q6").Cells(4, 8).Value = "CORRECT"
Worksheets("q6").Cells(12, 7).Value = 5
Worksheets("q6").Cells(10, 7).Value = 2
Else
Worksheets("q6").Cells(4, 8).Value = "IN CORRECT - no more attempts"
Worksheets("q6").Cells(5, 8).Value = "CORRECT ANSWER - B"
Worksheets("q6").Cells(12, 7).Value = 0
Worksheets("q6").Cells(10, 7).Value = 2
End If
Range("F4").Select
protectionON
End Select
End Sub