Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Link Macros Excel 2007

I recorded a macro (very large copy from one sheet and paste into another
sheet). It works fine. I then made some edits to it so that it would be more
generic abd reusable. This caused it to be to big to compile so I have to
slice it up into multiple marros.Both still work fine. How do I link the
maros so after macro1 finishes, marcor2 will start or is that just going to
introduce the file size problem again?

Do comments count in compield file size? I extensively commented the maro so
I could find my way around when debugging.

Thanks - John
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 419
Default Link Macros Excel 2007

JohnH,

Are both of these macros in the same module?

I have no experience with XL 2007, but VBA in XL 2007 & XL 2003 should be
almost identical.

In order to start the 2nd macro after the 1st one has run, just call the 2nd
one from the 1st one. In the very last line of the 1st macro (between your
last line of code and "End Sub"), put the name of the second macro.

Keep in mind, I've never run into "to big to compile" errors, so I don't
know if doing things this way will cause the same problems you were having
before.

HTH,

Conan




"JohnH" wrote in message
...
I recorded a macro (very large copy from one sheet and paste into another
sheet). It works fine. I then made some edits to it so that it would be
more
generic abd reusable. This caused it to be to big to compile so I have to
slice it up into multiple marros.Both still work fine. How do I link the
maros so after macro1 finishes, marcor2 will start or is that just going
to
introduce the file size problem again?

Do comments count in compield file size? I extensively commented the maro
so
I could find my way around when debugging.

Thanks - John



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Link Macros Excel 2007

Thanks Conan

I really don't know my way around Macros/VB. I understand what you said but
don't know the details.

All my macros for this project are in the same worksheet.

When opening Macro1 in edit mode at the end there is a dividing line and
Macro2 starts. It appears the both macros are part of the same file? I did
not intentionally set it up that way. I suspect functions as designed? When
I run Macro1 it stops. at the End Sub line. It does not auto run Macro2 which
starts immedatley after the dividing line. I tried pasting Sub Macro2() above
End SUb in Macro1 but that causes a compile error until I remove it. If I
paste all the Macro2 code into Marco1 I get the too big compile error when I
run it.

What is the syntax for adding the call to macro2 in macro1?

Thanks
John


"Conan Kelly" wrote:

JohnH,

Are both of these macros in the same module?

I have no experience with XL 2007, but VBA in XL 2007 & XL 2003 should be
almost identical.

In order to start the 2nd macro after the 1st one has run, just call the 2nd
one from the 1st one. In the very last line of the 1st macro (between your
last line of code and "End Sub"), put the name of the second macro.

Keep in mind, I've never run into "to big to compile" errors, so I don't
know if doing things this way will cause the same problems you were having
before.

HTH,

Conan




"JohnH" wrote in message
...
I recorded a macro (very large copy from one sheet and paste into another
sheet). It works fine. I then made some edits to it so that it would be
more
generic abd reusable. This caused it to be to big to compile so I have to
slice it up into multiple marros.Both still work fine. How do I link the
maros so after macro1 finishes, marcor2 will start or is that just going
to
introduce the file size problem again?

Do comments count in compield file size? I extensively commented the maro
so
I could find my way around when debugging.

Thanks - John




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 419
Default Link Macros Excel 2007

JohnH,

From the sounds of it, you have your macros in one module.

Your macros are probably in the form of:



Sub Macro1()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
End Sub

-------------------------

Sub Macro2()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
End Sub



Change your code to the following:



Sub Macro1()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
Macro2
End Sub

-------------------------

Sub Macro2()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
End Sub



Notice, I put the call to Macro2 (just put the macro's name) within Macro1,
just after the last line of code.

HTH,

Conan






"JohnH" wrote in message
...
Thanks Conan

I really don't know my way around Macros/VB. I understand what you said
but
don't know the details.

All my macros for this project are in the same worksheet.

When opening Macro1 in edit mode at the end there is a dividing line and
Macro2 starts. It appears the both macros are part of the same file? I did
not intentionally set it up that way. I suspect functions as designed?
When
I run Macro1 it stops. at the End Sub line. It does not auto run Macro2
which
starts immedatley after the dividing line. I tried pasting Sub Macro2()
above
End SUb in Macro1 but that causes a compile error until I remove it. If I
paste all the Macro2 code into Marco1 I get the too big compile error when
I
run it.

What is the syntax for adding the call to macro2 in macro1?

Thanks
John


"Conan Kelly" wrote:

JohnH,

Are both of these macros in the same module?

I have no experience with XL 2007, but VBA in XL 2007 & XL 2003 should be
almost identical.

In order to start the 2nd macro after the 1st one has run, just call the
2nd
one from the 1st one. In the very last line of the 1st macro (between
your
last line of code and "End Sub"), put the name of the second macro.

Keep in mind, I've never run into "to big to compile" errors, so I don't
know if doing things this way will cause the same problems you were
having
before.

HTH,

Conan




"JohnH" wrote in message
...
I recorded a macro (very large copy from one sheet and paste into
another
sheet). It works fine. I then made some edits to it so that it would be
more
generic abd reusable. This caused it to be to big to compile so I have
to
slice it up into multiple marros.Both still work fine. How do I link
the
maros so after macro1 finishes, marcor2 will start or is that just
going
to
introduce the file size problem again?

Do comments count in compield file size? I extensively commented the
maro
so
I could find my way around when debugging.

Thanks - John






  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Link Macros Excel 2007

Thanks Much Conan- It works great and no more too large to compile errors.

Thanks
John

"Conan Kelly" wrote:

JohnH,

From the sounds of it, you have your macros in one module.

Your macros are probably in the form of:



Sub Macro1()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
End Sub

-------------------------

Sub Macro2()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
End Sub



Change your code to the following:



Sub Macro1()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
Macro2
End Sub

-------------------------

Sub Macro2()
'1st line of code
'2nd line of code
...
...
...
'Last line of code
End Sub



Notice, I put the call to Macro2 (just put the macro's name) within Macro1,
just after the last line of code.

HTH,

Conan






"JohnH" wrote in message
...
Thanks Conan

I really don't know my way around Macros/VB. I understand what you said
but
don't know the details.

All my macros for this project are in the same worksheet.

When opening Macro1 in edit mode at the end there is a dividing line and
Macro2 starts. It appears the both macros are part of the same file? I did
not intentionally set it up that way. I suspect functions as designed?
When
I run Macro1 it stops. at the End Sub line. It does not auto run Macro2
which
starts immedatley after the dividing line. I tried pasting Sub Macro2()
above
End SUb in Macro1 but that causes a compile error until I remove it. If I
paste all the Macro2 code into Marco1 I get the too big compile error when
I
run it.

What is the syntax for adding the call to macro2 in macro1?

Thanks
John


"Conan Kelly" wrote:

JohnH,

Are both of these macros in the same module?

I have no experience with XL 2007, but VBA in XL 2007 & XL 2003 should be
almost identical.

In order to start the 2nd macro after the 1st one has run, just call the
2nd
one from the 1st one. In the very last line of the 1st macro (between
your
last line of code and "End Sub"), put the name of the second macro.

Keep in mind, I've never run into "to big to compile" errors, so I don't
know if doing things this way will cause the same problems you were
having
before.

HTH,

Conan




"JohnH" wrote in message
...
I recorded a macro (very large copy from one sheet and paste into
another
sheet). It works fine. I then made some edits to it so that it would be
more
generic abd reusable. This caused it to be to big to compile so I have
to
slice it up into multiple marros.Both still work fine. How do I link
the
maros so after macro1 finishes, marcor2 will start or is that just
going
to
introduce the file size problem again?

Do comments count in compield file size? I extensively commented the
maro
so
I could find my way around when debugging.

Thanks - John






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
new link for excel macros [email protected] Links and Linking in Excel 0 October 25th 07 04:22 AM
Excel 2007 Graphs & Macros Ken Excel Discussion (Misc queries) 4 October 3rd 07 01:24 PM
Excel 2007 and macros Chimelle Excel Discussion (Misc queries) 5 September 7th 07 10:03 PM
Excel 2007 and Macros Rob[_4_] Excel Discussion (Misc queries) 4 April 19th 07 12:02 PM
Macros in Excel 2007 Graham Excel Discussion (Misc queries) 8 April 6th 07 10:59 PM


All times are GMT +1. The time now is 12:36 PM.

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

About Us

"It's about Microsoft Excel"