macro to refresh worksheet until cell meets a value

NightCa

New Member
Joined
Apr 24, 2023
Messages
18
Office Version
  1. 2021
Platform
  1. Windows
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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,215,208
Messages
6,123,642
Members
449,111
Latest member
ghennedy

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