ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Procedure too large (https://www.excelbanter.com/excel-programming/414319-procedure-too-large.html)

David

Procedure too large
 
Hi Group,

I am getting a message, "Procedure too large", there is a limit on the
amount of code that be be executed? This means I have to eliminate some of
the code?

Thanks,
David

Wigi

Procedure too large
 
Hello

See http://www.mrexcel.com/archive2/63500/73583.htm


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"David" wrote:

Hi Group,

I am getting a message, "Procedure too large", there is a limit on the
amount of code that be be executed? This means I have to eliminate some of
the code?

Thanks,
David


Chip Pearson

Procedure too large
 
If you are getting a message that a procedure is too large for the compiler,
then your procedure is *definitely* too large by any other measure. There
is a limit imposed by the compiler, but well-written code should never
approach that limit. You don't have to "eliminate" any code, but you need to
move code out that procedure and put it into a procedure that is called by
the main procedure. E.g., instead of

Sub AAA()
' do lots of stuff for task #1
' do lots of stuff for task #2
' do lots of stuff for task #3
End Sub

use structured code like

Sub AAA()
CallToOtherProcForTask1
CallToOtherProcForTask2
CallToOtherProcForTask3
End Sub

Sub CallToOtherProcForTask1
' code for task 1
End Sub

Sub CallToOtherProcForTask2
' code for task 2
End Sub

Sub CallToOtherProcForTask3
' code for task 3
End Sub



--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




"David" wrote in message
...
Hi Group,

I am getting a message, "Procedure too large", there is a limit on the
amount of code that be be executed? This means I have to eliminate some of
the code?

Thanks,
David



David

Procedure too large
 
Thanks Chip. I did a lookup on "Procedure too large" and this is what the
partners in crime suggested also. And it works great.



"Chip Pearson" wrote:

If you are getting a message that a procedure is too large for the compiler,
then your procedure is *definitely* too large by any other measure. There
is a limit imposed by the compiler, but well-written code should never
approach that limit. You don't have to "eliminate" any code, but you need to
move code out that procedure and put it into a procedure that is called by
the main procedure. E.g., instead of

Sub AAA()
' do lots of stuff for task #1
' do lots of stuff for task #2
' do lots of stuff for task #3
End Sub

use structured code like

Sub AAA()
CallToOtherProcForTask1
CallToOtherProcForTask2
CallToOtherProcForTask3
End Sub

Sub CallToOtherProcForTask1
' code for task 1
End Sub

Sub CallToOtherProcForTask2
' code for task 2
End Sub

Sub CallToOtherProcForTask3
' code for task 3
End Sub



--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




"David" wrote in message
...
Hi Group,

I am getting a message, "Procedure too large", there is a limit on the
amount of code that be be executed? This means I have to eliminate some of
the code?

Thanks,
David




All times are GMT +1. The time now is 04:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com