# Solved: Excel Macros too large problem



## theseus75 (Jan 7, 2005)

I've recorded and combined a few macros into one and - while it is really large - I never thought anything of it until I got the following error while trying to run it:

"Compile Error
Procedure too large"

I can certainly split these up into separate procedures, but it would save time to have them all as one. Is there a way to override this error? 

I am using Windows XP w/ SP2 and Excel 2003. 

Thanks in advance for any help.


----------



## OBP (Mar 8, 2005)

It is probably quite possible that you can considerably reduce the size of the Macro by rewriting it. Recorded Macros are notorious for having superfluous code in them. 
If you post it I am sure that one of the Excel gurus can rewrite it for you, or at least point you in right direction.


----------



## Rollin_Again (Sep 4, 2003)

Break the large macro into seperate subs and then call each of the separate subs from your main procedure. Doing it this way makes your code much easier to maintain and you can still execute all the code by running your main macro only.

If you need more help please post your sample workbook or code and we'll take a look and offer more advice.


```
Sub MainMacro()
Call Macro1
Call Macro2
Call Macro3
End Sub


Sub Macro1()
'Your Code
'Your Code
End Sub

Sub Macro2()
'Your Code
'Your Code
End Sub

Sub Macro3()
'Your Code
'Your Code
End Sub
```
Regards,
Rollin


----------



## theseus75 (Jan 7, 2005)

Thanks for the help: that code worked perfectly, Rollin_Again. 
OBP: Yeah, I'm sure my code has plenty of little extras, but the Call method seemed to take care of it. One of these days I'll get around to cleaning them up a bit. 
Thanks again!


----------

