Macro to auto-refresh the worksheet until a certain condition is met

turatski

New Member
Joined
Jul 5, 2015
Messages
1
Hi guys. First of all, let me just say that I have very little knowledge of VBA and any form of help from you guys would be awesome.

Here is the formula that I already have.

Cells A1 to A5 have =randbetween(1,5)
Cells B1 to B5 also have the same =randbetween(1,5)
Cells C1 to C5 =Sum(A1:B1) and so on.
Cell D1 =countif(C1:C5,10)

Here's my problem: Can you guys help me with a macro that focuses only on the "D1" cell, such that the worksheet would auto-refresh until "D1 > 0"?

Again, Thank you guys for your time in reading my post and for any help that you could extend!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
<font face=Calibri>Option Explicit<br><SPAN style="color:#007F00">' always have option explicit as your first line in any module</SPAN><br><br><SPAN style="color:#00007F">Sub</SPAN> CheckLarger10()<br>    <SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    <br>    <SPAN style="color:#00007F">For</SPAN> i = 1 <SPAN style="color:#00007F">To</SPAN> 100000<br>    <SPAN style="color:#007F00">' give it an end, else it could be stuck forever</SPAN><br>        Application.Calculate<br>        <SPAN style="color:#00007F">If</SPAN> Range("D1") > 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">For</SPAN><br>    <SPAN style="color:#00007F">Next</SPAN> i<br>    <br>    MsgBox "achieved in " & i & " calculations"<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>
 
Upvote 0

Forum statistics

Threads
1,215,564
Messages
6,125,581
Members
449,237
Latest member
Chase S

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top