Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Splitting a Procedure

Mark,

That's a lot of tedious typing that you did.

Along with what Steve gave you regarding shortening the
actual lines of code, you can split this up into separate
(smaller) subs in this fashion:

What you have now:
Case1
' lots of code
Case2
'lots of code
Case3
'lots of code
' etc.

What you can do:
Create a new sub named "Sub myCase0()"
Into that sub, move all of the Case0 code.
Create another sub named "Sub myCase1()"
Into that sub, move all of the Case1 code.
Do the same for the rest of the Cases

Now, in your main sub just call those other subs:
e.g.

Private Sub Up1_Click()
Select Case LB1.ListIndex
Case 0 'First item in list
myCase0
Case1
myCase1
'etc.

John

Mark wrote:

When I run the code below I get a compile error message
that states procedure to large. The knowledge base tells
me to split the procedure. How do i do this? Here is the
procedure below. Any suggestions or help is extremely
appreciated.


Reply
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
sub procedure Jim Excel Discussion (Misc queries) 2 November 12th 09 02:52 PM
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
Procedure is too big Frank Situmorang Excel Worksheet Functions 2 May 2nd 07 05:06 AM
VBA Procedure Jeff Excel Discussion (Misc queries) 0 January 20th 06 04:22 PM


All times are GMT +1. The time now is 03:15 PM.

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"