Procedure Too Large Error Message Fix
Posted by Nonaluuluu on Wednesday, August 23, 2017 · Leave a Comment
Procedure Too Large Error Message Fix
How to Fix Compile Error: Procedure Too Large
The error message "Compile error: Procedure too large" appears in Excel 2007, 2010, and 2013 when you try to execute more than 3,000 lines of code in a single module. This pop-up error message is annoying for developers who are building complex programs. According to the Microsoft Website, this error message occurs when you try to execute code "that exceeds 64kb when compiled." I found a simple solution that fixes this error message and allows you to execute an unlimited amount of code in VBA.
Fix: Link Multiple Modules Together in VBA
To bypass the Procedure Too Large error message, simply link two modules or subprocedures together from separate workbooks.
1. In Workbook1, open up Workbook2 with the below code:
Workbooks.Open Filename:="C:\Users\Desktop\VBATutorialCode Lessons\Reference Second Module\" & "Workbook2.xlsm"
2. In Workbook1, run the code for the Module in Workbook2 from Workbook1:
Application.Run "Workbook2.xlsm" & "!SecondModule"
3. !SecondModule is the name of the module from the second workbook as pictured below:
Video Fix
If you want to watch me link two modules together in VBA from different workbooks, then watch the below video from my Youtube. I recommend that you switch the video quality to 1080P HD. If you are on mobile, please watch the video on My Youtube because embedded videos on my website have worse quality on mobile than the video on Youtube.