LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How big can code be?

There are limits both to the size of a single procedure and to the
size of a module, but MS doesn't publish them (probably because they
are limits on the internal representation of the VBA code, not the
code as it exists as editable text).

However, if you get a message like "Procedure Too Large" or "Module
Too Large", you have long passed the practical limitations. Neither a
single procedure nor a single module should be anywhere near the
maximum size allowed by VBA. Good programming practice and
organization would have you break large procedures into multiple,
smaller, and reusable procedures and organize those procedures into
various modules based on functionality.

It is a known problem, however, that VBA doesn't always clean up after
itself if the code has been heavily edited. There is junk code left in
VBA's internal storage areas and this can cause some very weird
behavior, behavior that is often impossible to reliably reproduce and
debug. The solution is to export all VBA code out to text files, purge
it from VBA, and the re-import all the code from the text files, in
order that VBA starts from a clean slate. Rob Bovey has a must-have
utility called Code Cleaner that completely automates this
export/import process. See
http://www.appspro.com/Utilities/CodeCleaner.htm . Every developer
should have and use Rob's Code Cleaner.

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


On Thu, 10 Sep 2009 02:49:01 -0700, Jock
wrote:

Is there a practicalimit on the amount of code you can use in various
modules, user forms and sheets within a workbook?
I ask because the code in a workbook I am creating stops working after a few
code executions and I need to close excel down and reopen the workbook.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
How can I modify my code to offset the defined range and repeat theprocedure instead of duplicating my code? [email protected] Excel Programming 4 May 29th 09 10:13 PM
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does ker_01 Excel Programming 6 October 3rd 08 09:45 PM
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. Corey Excel Programming 3 December 11th 06 05:14 AM
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM


All times are GMT +1. The time now is 05:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"