Ok, I came up with something on my own. It seems to work pretty well and I
would like to share it in case someone else needs it.
Private Sub CommandButton1_Click()
Do
Calculate
Loop Until [J3] = [J15] Or [J4] = [J15] Or [J5] = [J15] Or [J6] = [J15] Or
[J7] = [J15] Or [J8] = [J15] Or [J9] = [J15] Or [J10] = [J15] Or [J11] =
[J15] Or [J12] = [J15] Or [K3] = [J15] Or [K4] = [J15] Or [K5] = [J15] Or
[K6] = [J15] Or [K7] = [J15] Or [K8] = [J15] Or [K9] = [J15] Or [K10] = [J15]
Or [K11] = [J15] Or [K12] = [J15] Or [L3] = [J15] Or [L4] = [J15] Or [L5] =
[J15] Or [L6] = [J15] Or [L7] = [J15] Or [L8] = [J15] Or [L9] = [J15] Or
[L10] = [J15] Or [L11] = [J15] Or [L12] = [J15]
[Exit Do]
End Sub
This is probably very simple for most of you, but it took me forever to find
a solution <G>.
Basically what this is doing is searching for a match from a block of 30
cells (J3:L12) until one of them matches another cell (J15). Each of the
aforementioned cells contains a =randbetween(1,20000) so it cycles through a
ton of numbers for several seconds before hitting a match.
"Fleone" wrote:
> I would like to know how to run the Calculate function until a match between
> two cells occurs.
> With the help of Ikaabod, Niek and Gary's Student I created a series of
> randomly generated numbers. I have a completely separate cell that is also
> running the RANDBETWEEN function. I would like to have a button that when
> pushed runs the Calculate command on the worksheet until a match occurs
> between two cells that are generating random numbers.
> Is this possible?
> Thanks!
Bookmarks