View Single Post
 
Old 09-03-2014, 05:46 AM
gebobs gebobs is offline Windows 7 64bit Office 2010 64bit
Expert
 
Join Date: Mar 2014
Location: Atlanta
Posts: 837
gebobs has a spectacular aura aboutgebobs has a spectacular aura about
Default

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.
Attached Files
File Type: xlsm Book1.xlsm (16.1 KB, 24 views)
Reply With Quote