View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Nick Hodge
 
Posts: n/a
Default The worst Code Ever

Jacob

You can use the Ontime method of the application object to run code at a
specified time and then loop from that procedure back to the timer one, like
this

Sub WaitOneMinute()
Application.OnTime EarliestTime:=Now() + TimeValue("00:01:00"), _
Procedu="RunNow"
End Sub

Sub runNow()
'Do your refresh here
WaitOneMinute
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Jacob_F_Roecker" wrote in message
...
OK I think that I've got the record for the WORST code EVER.

I wanted to build a spreadsheet that would automatically become a webpage.

I built the macro and I was good. COOL BEANS

But I wanted excel to do that every minute...because it referenced a
external data that updated every minute.

I got it to work the WORST possible way you could imagine for code and
speed.

I told it to calculate the difference between two cells--each of which
were
times/dates.

Basically my Macro is continuously running the =now() on one cell until
it's
been a minute and then it runs the other code.... starts all over and does
it
again.

I KNOW there are more efficient ways of doing this but google didn't point
me to anything I could understand.

Someone mind writing me and letting me know the BEST way to do this? I'm
game for some reading.