Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Excessive memory used in Excel 2013 during range merge called through VBA

$
0
0
Hello,

Our organization is in the process of migrating from Office 2003 to Office 2013 and from Windows XP to Windows 7. So far the process is going smoothly, however about a week ago someone contacted me because they were having trouble with a particular Excel report they used to generate. The workbook is an Excel 2003 workbook which contains quite a bit of VBA code which pulls information from various SQL tables and then formats the information. When I began looking at the code I noticed that there were a couple of places where a range of cells was being merged.


One sample of code looks like:

Call Range(Cells(CStr(NUMBER_OF_ROWS_MORE_THAN_ROWCOUNT_TO_FAMILY_LIST + NUMBER_OF_DETAIL_ROWS), PRODUCT_CAT_FIRST_COLUMN), Cells(CStr(NUMBER_OF_ROWS_MORE_THAN_ROWCOUNT_TO_FAMILY_LIST + NUMBER_OF_DETAIL_ROWS + Cells(NUMBER_OF_DETAIL_ROWS + NUMBER_OF_ROWS_MORE_THAN_ROWCOUNT_TO_FAMILY_LIST, CATEGORY_COUNT_COLUMN)), PRODUCT_CAT_LAST_COLUMN)).Merge(True)


Now this is pretty hard to read because it includes a number of constants, but essentially the code is trying to merge about 1 column with data together with the 24 empty columns beside it, for about 600 rows.


The original developer is long since gone so I can't ask why they did what they did, or how, but I can tell you that in Excel 2003 this line runs without so much as a hiccup. On Excel 2013 memory usage for the Excel process shoots from between 90-130MB up to 1.4GB and then settles back down. I'm trying to understand why there would be such a dramatic difference in behavior between the two versions of Excel, and what I can do to fix it?

Any suggestions are welcomed.

Thanks,
Troy.

Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>