Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

combining macros

0

Is it possible to combine several existing macros to one macro? I tried but there seem to stay lines that should be  deleted. I am also not sure whether the sequence of the macros matters.

Answer
Discuss

Discussion

Post your macros, either by editing your question or by attaching a workbook (you can do that in Edit mode). Your doubt as to the importance of sequence is confusing. If the macros work independent of each other they shouldn't be joined and if they work together it's hard to imagine that their sequence shouldn't be primary importance.
Variatus (rep: 4889) Oct 2, '19 at 12:01 am
Add to Discussion

Answers

1
Selected Answer

It may be better to 'CALL' the macros?  Depending on what your macros do, the order may be important.  You could create a new macro that calls the others. 

Sub CallAll()
  Call Macro1
  Call Macro2
  Call Macro3
End Sub

 - Replace MacroX with your macros.

Discuss

Discussion

Thank you very much for answering my question soo quickly. I first had to  figure out in what way I had to put it in a new macro. I finally did it this way:

  Sub WimCallAllemaal() Call dag1   Call WimNmFlm End Sub
I hope to find out one day why there  is no  '  in the text necessary and whether it is important to put some extra spaces between the lines (I did find  it in other macro's).
I also discovered that it's only possible to try a macro from VBS only having opened the relevant sheet.
I still wonder if it is important in which directory I I place my new macro (all opened directories, my workdirectory, the directory with the name of my file) . Till now I only use " " my workdirectory".
Sometimes I see a dot placed in a macro; I wonder what the effect is of placing a dot in front of a line.

Thanks again for answering :-)



woostra (rep: 2) Oct 4, '19 at 2:22 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login