Hi everyone,
I have a macro that populates a spreadsheet with a lot of bloomberg data (using BDP formulas) and a separate macro that copies/pastes values to lock down this data before creating reports with it. The copy/paste operation can take several minutes to complete. To monitor this and whether or not the macro is hanging (the file is huge and can occasionally crash), I am using a loop to go through the rows one by one and copy paste values on each, while updating the statusbar to tell me what row is being worked on. The issue that I am noticing is that the macro slows down over time. For example, it starts working at ~100 rows per second, slow to about 50 rows per second, then 40..30..20..and settles around 10 per second, which is a huge decrease in speed from beginning to end.
I fully understand that the loop+statusbar is not the fastest way to perform the operation, especially updating the statusbar every row, but I prefer this to raw overall speed as it lets me monitor the progress and know if the file is crashing. My question is why the operation slows down over time. If anything, I would think that it would speed up towards the end as thousands of rows above have been converted from formulas to values, which reduces the file size considerably at the end (but maybe not until I save?). It seems like something is building up in memory or dependency tables or something the longer it runs and this is slowing it to a crawl by the end. Any ideas what this could be or suggestions for obtaining more consistent speed throughout the operation? One thing to note is that if I run it a second time after the formula cells have already been pasted as values, it runs perfectly fine... fast and consistent speed through all rows. Here is my code:
![]()
Please Login or Register to view this content.
Bookmarks