macro to refresh worksheet until cell meets a value

  • Thread starter Thread starter Legacy 505880
  • Start date Start date
L

Legacy 505880

Guest
hello everybody. I'm looking for a macro that updates a sheet until a certain cell meets a value. The cell in question depends on many random parameters so it can become lengthy to manually refresh pressing f9 hundreds of times until it meets a value (let's say for example that this value is 1). The cell (let's say, for example, A1) in question is located in a specific sheet, so the macro should be only looking in the cell of that sheet, rather than all of them. Thank you in advance.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
For example
VBA Code:
Sub TryNTry()
Dim myTim As Single
'
myTim = Timer
Do
    Calculate
    DoEvents
    If Sheets("ThatSheet").Range("A1").Value = 1 Then Exit Do
    'If Timer > (myTim + 3600) Then Exit Do
Loop
MsgBox ("Got it?")
End Sub
If you prefer setting a timeout of 1 hour then remove the apostrophe in fron of the line If Timer etc etc
 
Upvote 0
Solution
Thank you for the feedback
If that resolve the problem then it'd be better to mark the discussion as Resoved; see the procedure: Mark as Solution
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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