Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Excel macro stopping

Excel macro stopping

Excel macro stopping

I have an excel sheet that performs calculations then i use a macro to copy and paste the results into another sheet. The macro then continues to call in new data from a source and the sheet re-calculates and copy and paste again. The sheet is around 10mb in size.
I have 2 issues. Firstly the macro just stops after a period, anything from 10 mins to 10 hours. Secondly the macro takes all the CPU available on my pc. I have included a delay between calling each action 1) calling in source data  2)re-calculating sheet  3) copy and paste. But even during these gaps the macro takes all the cpu. Can i write a better macro that frees up the cpu, i am thinking maybe this 100% cpu usage is stopping the macro?

Can anyone help?

RE: Excel macro stopping

you say "continues to call in data from a source" - is this source an external seriel type of source? This could totally block the PC if you continueously request data from the seriel port i believe.

I dont know about the stopping - but win 95-98 me? is not very suited for real time data acc. application as far as i know (unix or the like should be better).

Best Regards


RE: Excel macro stopping

we use windows 2000. The data is from an external source, ie share prices from a data vendor.

RE: Excel macro stopping


I don't think adding a timer will help, since in VBA the timer is executed synchronously.
You could try adding a "DoEvents" statement at strategic parts of the code. This tells the program to release the CPU for other tasks, and is needed if you have "tight" CPU intensive code.

RE: Excel macro stopping


I have a word program template that reads data from an excel program (just a spreadsheet with a TON of formulas).  I also have a "read me" sheet that (in effect) just reads the data from the excel program.  When I try to update the wordfile without the "read me" file open, it takes forever!  It takes so long because word is continually reading values, recalculating the sheet and pasting values.  With the "read me" sheet open, the update takes only seconds.

I don't know what would happen if you turned excel's "Auto calculate" off and then tried your macro.  It may help speed the process (it may not be an option though, from what it sounds like...).  You may also want to see if you can import all the external data into an array variable in VBA or even another excel spreadsheet and try to read it from there.

Hope this helps!


RE: Excel macro stopping

There are several ways to make your spreadsheet run faster.
For example, copying and pasting by "Range" instead of writing to cells by looping blocks, turning off screen updating by using Application.Screenupdating=False, etc.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close