Run macro after 10 seconds if cell doesn't change

Trickle

New Member
Joined
Feb 23, 2012
Messages
12
Hi All

I know you can pause a macro using Application.Wait, but I need to have the sheet available for cell AA10's contents to be updated by an external link, and only run the macro if the cell is not updated within 10 seconds.

Would Application.Wait make the sheet unavailable for external update, and if so, if there another way of doing it?

Many thanks in advance for any suggestions.

Trickle
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Can you please elaborate on external link?
you definitely have work around for that too. maybe second workbook to run macro and other to get feed from other ext links you're referring to.
 
Upvote 0
The following will do what you are asking.
The MsgBox lines are simply for testing.

Code:
Sub Wait2Run()
    
    StartTime = Timer
    startAA10 = Range("AA10").Value
    Do While Timer < StartTime + 10    'wait 10 seconds max
        DoEvents    'allow updates, etc.
        If startAA10 <> Range("AA10").Value Then
            'the cell value changed
            MsgBox "Success", vbInformation, "=)"
            Exit Sub
        End If
    Loop
    
    Call FailMacro    'cell didn't change for 10 seconds
End Sub
Sub FailMacro()
    MsgBox "Failed", vbExclamation, "=("
End Sub
 
Upvote 0
The external link is to a betting scheduler, so I'm not sure the second spreadsheet is an option. Many thanks for the code - this looks ideal, and I'll test it tomorrow.

Thanks again for your time and expertise.

Trickle
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

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