Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

Can I have two sub procedures in one Macro in excel?

And if so, how would I do it?

Thanks
0
sarasotamac
Asked:
sarasotamac
1 Solution
 
mvidasCommented:
sarasotamac,

Yes, well kinda (one macro can only have one sub/end sub), you call other subs from the first.  A quick example:

Sub sarasotamac1()
 MsgBox "This is in the sarasotamac1 Sub"
 sarasotamac2
 Call sarasotamac4 'note that using/not-using call does the same thing
End Sub

Sub sarasotamac2()
 MsgBox "This is in the sarasotamac2 Sub"
 sarasotamac3
End Sub

Sub sarasotamac3()
 MsgBox "This is in the sarasotamac3 Sub"
End Sub

Sub sarasotamac4()
 MsgBox "This is in the sarasotamac4 Sub"
End Sub

Matt
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now