PC Review


Reply
Thread Tools Rate Thread

Automatic Calculation in Code Takes Longer than Worksheet

 
 
adambush4242@hotmail.com
Guest
Posts: n/a
 
      7th Jan 2009
I have a macro that grabs the current time from a website and then brings it
into my worksheet. I put manual calculation on when I run this and it takes
less than a second. However, when I put the sheet back on auto calc, it
takes 53 seconds to recalculate. If i actually go into the worksheet, put it
on manual, type in the new time, and then put it back on auto it only takes 5
seconds to recalc. Any reason why there would be such a discrepency? I have
several user defined functions in the workbook, but they are being used by
either form of recalculation. Any help would be greatly appreciated.

Thanks

Adam Bush
 
Reply With Quote
 
 
 
 
Bob Umlas, Excel MVP
Guest
Posts: n/a
 
      7th Jan 2009
See if you have worksheet_change event code which may be running in a loop
because when you put in the time, you're changing the worksheet and this can
cause the event code to run again. If that's the case, precede the entry of
the time with
Application.EnableEvents = False
and turn it to true afterwards.
HTH
Bob Umlas

"(E-Mail Removed)" wrote:

> I have a macro that grabs the current time from a website and then brings it
> into my worksheet. I put manual calculation on when I run this and it takes
> less than a second. However, when I put the sheet back on auto calc, it
> takes 53 seconds to recalculate. If i actually go into the worksheet, put it
> on manual, type in the new time, and then put it back on auto it only takes 5
> seconds to recalc. Any reason why there would be such a discrepency? I have
> several user defined functions in the workbook, but they are being used by
> either form of recalculation. Any help would be greatly appreciated.
>
> Thanks
>
> Adam Bush

 
Reply With Quote
 
adambush4242@hotmail.com
Guest
Posts: n/a
 
      8th Jan 2009
I tried disabling and enabling events and it was the same speed. Do you
think this might have to do with the user defined functions I have running?
Any other ideas?

Thanks

Adam Bush

"Bob Umlas, Excel MVP" wrote:

> See if you have worksheet_change event code which may be running in a loop
> because when you put in the time, you're changing the worksheet and this can
> cause the event code to run again. If that's the case, precede the entry of
> the time with
> Application.EnableEvents = False
> and turn it to true afterwards.
> HTH
> Bob Umlas
>
> "(E-Mail Removed)" wrote:
>
> > I have a macro that grabs the current time from a website and then brings it
> > into my worksheet. I put manual calculation on when I run this and it takes
> > less than a second. However, when I put the sheet back on auto calc, it
> > takes 53 seconds to recalculate. If i actually go into the worksheet, put it
> > on manual, type in the new time, and then put it back on auto it only takes 5
> > seconds to recalc. Any reason why there would be such a discrepency? I have
> > several user defined functions in the workbook, but they are being used by
> > either form of recalculation. Any help would be greatly appreciated.
> >
> > Thanks
> >
> > Adam Bush

 
Reply With Quote
 
Bob Umlas, Excel MVP
Guest
Posts: n/a
 
      8th Jan 2009
You could turn calculation off, but without actually having the workbook it's
hard to know what else is going on. It shouldn't be any slower in code than
without code, so something is certainly happening. Feel free to email me the
wb -- (E-Mail Removed), and explain the issue. Use subject of "AllExpertsQ"

"(E-Mail Removed)" wrote:

> I tried disabling and enabling events and it was the same speed. Do you
> think this might have to do with the user defined functions I have running?
> Any other ideas?
>
> Thanks
>
> Adam Bush
>
> "Bob Umlas, Excel MVP" wrote:
>
> > See if you have worksheet_change event code which may be running in a loop
> > because when you put in the time, you're changing the worksheet and this can
> > cause the event code to run again. If that's the case, precede the entry of
> > the time with
> > Application.EnableEvents = False
> > and turn it to true afterwards.
> > HTH
> > Bob Umlas
> >
> > "(E-Mail Removed)" wrote:
> >
> > > I have a macro that grabs the current time from a website and then brings it
> > > into my worksheet. I put manual calculation on when I run this and it takes
> > > less than a second. However, when I put the sheet back on auto calc, it
> > > takes 53 seconds to recalculate. If i actually go into the worksheet, put it
> > > on manual, type in the new time, and then put it back on auto it only takes 5
> > > seconds to recalc. Any reason why there would be such a discrepency? I have
> > > several user defined functions in the workbook, but they are being used by
> > > either form of recalculation. Any help would be greatly appreciated.
> > >
> > > Thanks
> > >
> > > Adam Bush

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array takes 6x longer to process VLOOKUP than worksheet table does KGOldWolf Microsoft Excel Programming 3 5th Nov 2009 03:49 PM
Automatic Calculation on only one Worksheet =?Utf-8?B?c2ZyYW5jb2Uy?= Microsoft Excel Misc 5 3rd Dec 2005 09:03 PM
Windows service - what happens if the code takes longer to execute than the interval allows if a Timer is used? hazz Microsoft VB .NET 7 2nd Aug 2005 12:46 PM
Running code as a transaction takes 3 times longer cyndire Microsoft C# .NET 1 13th Aug 2004 05:06 PM
Worksheet.Calculate code no longer executes on worksheet launch? Arris Microsoft Excel Worksheet Functions 1 28th Jan 2004 02:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:31 AM.