Split Long Macro

D

Doc60

Hi,

I have a macro which will not run because it is to large. How do I split the
macro into two macros so that after the first macro the second automatically
runs. Could you please help me with the code. My macros are simply named
Macro 1 and Macro 2.

Thank you
 
T

Tony Jollans

If you don't know enough to do this on your own, I presume you have
relatively simple, if long, and probably recorded, macros so there shouldn't
be any major issues, and this may work ...

Sub Macro1
' Do a lot of stuff
Macro2
End Sub
Sub Macro2
' do a lot more stuff
End Sub

Clearly this is simplistic, and if you do have complex code, copied from
elsewhere perhaps, there may be many things to consider and a more
comprehensive examination of the code will be needed to break it into
logical, independent, parts.
 
F

fumei via OfficeKB.com

"I have a macro which will not run because it is to large."

How, exactly, do you know this? Are you getting an error message? If so,
what message?
 
T

Tony Jollans

Hi Gerry,

64K is the maximum size, above which you get a compile error: procedure too
large - unusual for its clarity.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top