Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Command button to run calculation function

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Command button to run calculation function

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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign a function to a Command Button MUEEN SEHDI[_2_] Excel Worksheet Functions 3 November 1st 09 01:58 PM
Assign Function to a Command Button MUEEN SEHDI Excel Discussion (Misc queries) 1 October 29th 09 11:25 AM
Getting an ActiveX command button to do a spreadsheet function Givvie Excel Worksheet Functions 4 August 28th 07 11:18 AM
using command button instead of edit function john tempest[_2_] Excel Programming 7 December 21st 05 06:41 PM
Command Button Function - Macro NickH[_2_] Excel Programming 3 January 22nd 04 11:02 AM


All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"