Automatically refresh a sheet every hour?

Dave E

New Member
Joined
Apr 3, 2006
Messages
40
Hi.

Not sure if this is possible... sure it will be... I have a workseet that is basically a massive list of orders that have been placed. I have some conditional formatting based on cells that use the today() function to work out how long (in days) since the order was placed.

Trouble is, the spreadsheet is always open, and is never closed down... so it does not refresh automatically. So orders that should go red to indicate a week since they've been placed, don't!

I don't want to rely on people refreshing the screen. Ideally, I would like it to refresh once a day at 1 minute past midnight, or even every hour...

???

Cheers for any help...

Dave
 
hmm,


try this

Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime dTime, "MyMacro", False
End Sub

hopefully that does the trick,

anyone else know if that false will ensure the macro doesn't reopen and calculate?

guess you can always test it let us know
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi.

This does prevent the error message, but regrettably it does make the sheet keep re-opening on the specified interval (If excel is left open) :(

Sorry to keep bothering you with this, but its a great help! :eek:

Cheers

Dave
 
Upvote 0
Code:
Application.OnTime EarliestTime:=dTime, Procedure:="MyMacro", Schedule:=False

just tested it.. it should work :)

if not ill try again
 
Upvote 0
I'm afraid still the same :eek:

Just throws the error if you close the sheet within 1 minute (I changed the value for testing purposes).

edit: Oh, and it appears to kieep re-opening aswell with the latest code...
 
Upvote 0
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
    Application.OnTime EarliestTime:=dTime, Procedure:="MyMacro", Schedule:=False

End Sub

ok, one last attempt.. try it like that with the on error resume next in there.. that seems to work for me just fine.

PS.. is "works a treat" an english (UK) saying?
its not the first time I've seen it on here from the UK guys
 
Upvote 0
Regrettably, no joy... gets rid of the error message, but keeps reopening the sheet.

Never mind :)

Haha... Yes "Works a treat" must be a UK phrase... just means that it works well.

Cheers

Dave
 
Upvote 0
hmm.
I don't get it
this will bother me all day..

if anyone else has any ideas throw them out here

im at work so i can't give out my email, and IT blocks all the free email accounts like yahoo/hotmail etc.

if you can upload it somewhere I'll take a look.

i used all the code above and set it to 1 minute with a message box. every minute a message box poped up. so then i exited the workbook but left excel open. No error messages and i waited like 10 minutes no pop up box and it didn't open the workbook.
 
Upvote 0
I tried so many different things I can't figure it out. It has a mind of its own **** it.

anyone else got any ideas on how to end this ontime object correctly?
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,603
Members
449,321
Latest member
syzer

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