ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clearing memory using VBA (https://www.excelbanter.com/excel-programming/400269-clearing-memory-using-vba.html)

NathanG

clearing memory using VBA
 
Hi,

I have a problem with memory increasing in an instance of Excel. When excel
is first opened the memory is around 40k. There is a lot of VBA code running
macros to copy cells, connect to a database, retrieve etc etc

Each time a retrieve is done, which involves a large combination of actions,
the memory on the instance of excel increases 5 or 6 k. After 5 or 6 times
excel becomes slow, retrieves take longer and the only way to get rid of the
problem is closing excel completely. I have tried using

application.cutcopymode=false after copying data. There are also some global
variables and I have tried setting these to nothing but it has done very
little good. Is there a general piece of VBA code to clear the memory that
excel uses?

Thanks!

Nathan

Jim Thomlinson

clearing memory using VBA
 
Post your code... There are a couple of things you can do to release
memory/speed up execution. Depending how you are querying you might just need
to set your objects to nothing when you are done with them...
--
HTH...

Jim Thomlinson


"NathanG" wrote:

Hi,

I have a problem with memory increasing in an instance of Excel. When excel
is first opened the memory is around 40k. There is a lot of VBA code running
macros to copy cells, connect to a database, retrieve etc etc

Each time a retrieve is done, which involves a large combination of actions,
the memory on the instance of excel increases 5 or 6 k. After 5 or 6 times
excel becomes slow, retrieves take longer and the only way to get rid of the
problem is closing excel completely. I have tried using

application.cutcopymode=false after copying data. There are also some global
variables and I have tried setting these to nothing but it has done very
little good. Is there a general piece of VBA code to clear the memory that
excel uses?

Thanks!

Nathan



All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com