Procedure Too Large

Viewed 86632

I received this error message -Procedure too large - in VBA. What is the reason and way out for this error?

8 Answers

Not sure why the top voted post is recommended as the giant procedure code didn't work for me either. What did end up working was this:

Sub MacroName

Call ProcedureName1
Call ProcedureName2
etc...

End Sub

Sub ProcedureName1
'insert your vba code here

End Sub

The Call statement pulled each of the subs as long as I called the correct named sub.

Agreed, procedures should be split into smaller subs instead of one gigantic piece of code.

I have seen the Procedure too large errors on 32 bit installations of Excel, when they run / compile perfectly fine on the 64 bit installation the code was written on - so if it is a case of Procedure too large error [suddenly] occurring and it used to work before, check if the Excel installation you are trying to run the code on is 32 bit, and try on a 64 bit installation instead.

Use a 32-bit version of an Office 2010 program Or Divide the module into parts

My employees get the same message on their weaker computers, but I don't on mine. So it's either the fact that the memory on your computer is less than 16GB or otherwise it's the fact that you have an intel processor that's too weak. An i7 intel processor that's after the 8th generation should definitely get the job done. Just get a better computer processor and better memory on your computer and it will work.

Related