Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
new link for excel macros | Links and Linking in Excel | |||
Excel 2007 Graphs & Macros | Excel Discussion (Misc queries) | |||
Excel 2007 and macros | Excel Discussion (Misc queries) | |||
Excel 2007 and Macros | Excel Discussion (Misc queries) | |||
Macros in Excel 2007 | Excel Discussion (Misc queries) |