我正在做一个项目,你有一个随机数学方程式并解决它们然后跟踪它们。
我目前有两个按钮,其中一个是' start'按钮,用于跟踪解算方程所需的时间,并重置所有过去跟踪的方程式。
Private Sub btnStart_Click()
'Starts counting down from 11'
varCounter = 11
'Clear cells from the range'
Range("A11:K22").Clear
'Making Start time appear in the cell'
Range("G10") = "Start Time = "
'Showing the time started to do the first question'
Range("H10").Value = Now()
Range("H10").NumberFormat = "mm.ss"
'Making Difference appear in the cell'
Range("I10") = "Difference ="
'Clearing and making the typing go to the answer cell'
Range("H5").Activate
Range("H5") = " "
End Sub
另一个按钮是'检查'按钮,它将检查为等式编写的答案是否正确,并在下面的单元格中跟踪它。
Private Sub btnCheck_Click()
'Emoticons for right and wrong answers'
If Range("a3") * Range("c3") = Range("e3") Then
Range("f3").Font.Size = 36
Range("f3") = ChrW(&H263A)
Else
Range("f3") = ChrW(&H2639)
End If
'Get the time'
Range("J" & varCounter).Value = Now()
Range("J" & varCounter).NumberFormat = "mm.ss"
'Finding the time when answered and the differnece'
Time1 = Range("J" & varCounter).Value
Time2 = Range("J" & varCounter - 1).Value
Range("K" & varCounter).Value = Time1 - Time2
Range("K" & varCounter).NumberFormat = ("mm.ss")
'Make the answers go down the colum'
Range("a" & varCounter & ":f" & varCounter).Value = Range("a3:f3").Value
varCounter = varCounter + 1
'clearing and making the typing go to the answer cell'
Range("H5").Activate
Range("H5") = " "
'Clearing Cell'
Range("E3") = ""
If IsEmpty(Range("d20")) Then
Else
Range("D10:o100").Clear
varCounter = 11
Range("n10") = Time
Range("n10").NumberFormat = "mm:ss"
Range("K10") = "Difference ="
Range("G10") = "Start Time = "
End If
End Sub
如何将这两者组合在一起并制作它,以便我只需要输入答案并按Enter键而不需要按钮?