I kind of kludged it using a few "mirror" cells. Again it is using the condition level of 0.5 to make testing easier.
Cells A1 and A2 are as you have them.
Cell C1 stores the value of A1 as it is calculated when the button is pressed. This needs to be done because when the code writes the counter, it will recalculate the Rand() again and you won't see what the value was.
Cell C2 is the counter. If you use A2 as the counter, the code overwrites the equation.
Thus the code is:
Sub Button1_Click()
Dim x As Double
Calculate
x = Cells(2, 1)
Cells(1, 3) = Cells(1, 1)
Cells(2, 3) = Cells(2, 3) + x
End Sub
There are probably better ways. See attached.
|