Procedure Too Large - Breaking it down

scomar411

New Member
Joined
Jul 13, 2007
Messages
11
I've used the macro function to format a worksheet that will be used in other worksheets. Once complete I recieved the "procedure to large" message and am unsure how to "break-down" the code into smaller modules and then use to complete the task. How can I accomplish the task?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
It's hard to advise where to break your code without seeing it, but the basic idea is this:

Code:
Sub Format_everything()
myFormat1
myFormat2
End Sub

Sub myFormat1()
'do some stuff
End Sub

Sub myFormat2()
'do other stuff
End Sub

Then, calling Format_everything() will subsequently call the other two.
 
Upvote 0
Scomar , Oaktree:

I had a similar problem like this on a major project a few years ago.

the solution I used was

Sub 1

Code here

Call Sub2
End sub



sub 2
code here
call sub3
end sub

and so on.

Then I just broke the code into relatively equal sized subs.

Is this another way to do this, or is there an inherent problem with this format?

Thanks.
 
Upvote 0
It comes down to style.

Personally, I'd rather have one control sub like:

Sub Format_everything()
myFormat1
myFormat2
End Sub

so that it's easier to follow what the whole process is, but the snake method you're using would essentially function the same way.
 
Upvote 0
OK. I understand. Your method allows you to go to one sub as a "master" control. Sort of like a parrallel circuit.

My style is more of a series type of procedure. You could need to go through all of the procedures to debug.

THANK YOU.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top