1

I've spent the whole night doing fruitless "NG" retakes of a long series of Excel VBA scripts, only to encounter repeated issues of Compile Error "Procedure too Large".

As such, I would like to share my story and solution, and would also love to hear from you if you have any better ideas.

1 Answer 1

1

I debugged in Visual Basic, and found that by removing the following lines, the problem was resolved:

ActiveWindow.ScrollRow = 10
...
ActiveWindow.ScrollRow = 10000

I realised that as my records had more than 10k rows, Macro also captures each of my mousescrolls or keyboard page-down scrolls as an additional macro command all by itself. As such, it choked up the memory limits for the macro due to multiple downward scrolls. So, the problem was resolved by simply deleting all the lines associated with "ActiveWindow.ScrollRow".

I guess it would have helped if I had used a newer MS version or a more powerful Mac. Suggestions are welcome on how the Macro recording could have been better done, especially on the need to scroll down to capture deep rows. Do note that I did not select the entire column (by clicking on the column headers) to avoid hitting the max limit of the rows (hence adding unnecessary CPU load ... I guess). What about folks using newer Office like 2013 ... was it worth the upgrade as far as Macros are concerned?

Sign up to request clarification or add additional context in comments.

1 Comment

True. Then you might find THIS - Point 6 interesting... Even after you have removed unnecessary code lines,, if you feel the code is still huge, break it up in separate procedures :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.