Run Multiple Macros Throws Error

tomgrandy

New Member
Joined
May 10, 2024
Messages
20
Office Version
  1. 365
Platform
  1. MacOS
Trying to run multiple Macros at once so I can assign one button that will run three Macros sequentially.

This is what I have from searching these forums:

VBA Code:
Sub Keywords()
    Call KeywordFlakedArtifacts_A_K
    Call KeywordFlakedArtifacts_K_Z
    Call KeywordNonFlakedArtifacts
End Sub

But it throws the following error with the Sub Keywords() highlighted when I debug:
 

Attachments

  • Screenshot 2024-05-15 at 12.46.08 PM.png
    Screenshot 2024-05-15 at 12.46.08 PM.png
    57.3 KB · Views: 10
  • Screenshot 2024-05-15 at 12.46.21 PM.png
    Screenshot 2024-05-15 at 12.46.21 PM.png
    173.3 KB · Views: 10

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try changing the module name so there isn't a clash. A naming suggestion for module sheets is mod or bas before the assigned name so in your case:
modKeyWords as the module sheet name and then try your routine to call the other procedures.
 
Upvote 0
Changed Module Name but still getting the error of "Expected Variable or Procedure Not Module":

VBA Code:
Sub modKeyWords()
    Call KeywordFlakedArtifacts_A_K
    Call KeywordFlakedArtifacts_K_Z
    Call KeywordNonFlakedArtifacts
End Sub
 
Upvote 0
You've changed the procedure name not the module sheet names. In the project window on the top left change each module sheet name as I suspect your using the same name as each procedure name:
Change

KeyWordFlakedArtifacts_A_K
to
modKeyWordFlakedArtifacts_A_K

And change the other module names not the procedures. Then your call procedure should run ok. Change the procedure back to KeyWords
 
Upvote 0
Thanks for your response @Trevor G ! Here is a snippet of my Project Window. The Sheet Name, I believe, is not the same as the Modules or am I looking at the wrong box?
Screenshot 2024-05-16 at 1.57.00 PM.png
 
Upvote 0
In your screen capture (picture) you can see the folder named Modules. This folder holds each of your programming sheets called modules. This is where you should name each one with mod at the beginning, like this:

modKeywordFlakedArtifacts_A_K
modKeywordFlakedArtifacts_k_Z
modKeywordNonFlakedArtifacts

Next
On each module sheet this is where I think each procedure is named as follows:
KeywordFlakedArtifacts_A_K
KeywordFlakedArtifacts_k_Z
KeywordNonFlakedArtifacts

Therefore there should be no clashing with the procedure names (you might call them macros). Therefore your call procedure should work as long as the title doesn't clash with any other name you have used.

Your first thread #1 would be correct


Sub Keywords()
Call KeywordFlakedArtifacts_A_K
Call KeywordFlakedArtifacts_K_Z
Call KeywordNonFlakedArtifacts
End Sub
 
Upvote 0
Did some more searching @Trevor G and discovered that I needed to repeat the Call in order for it to recognize that I was calling a Module (I think).

Anyway, this is what worked:

VBA Code:
Sub RunALLKeyWordQueries()
    KeywordFlakedArtifacts_A_K.KeywordFlakedArtifacts_A_K
    KeywordFlakedArtifacts_K_Z.KeywordFlakedArtifacts_K_Z
    KeywordNonFlakedArtifacts.KeywordNonFlakedArtifacts
End Sub

••••ˇˇˇˇ
 
Upvote 0
Solution
As long as you've found a working solution and it works then great news.

Thank you for letting me know :)(y)
 
Upvote 0
@Trevor G - Thank you for taking the time and helping a newb understand a bit more about VBA Scripts. Much appreciated!
 
Upvote 0

Forum statistics

Threads
1,216,723
Messages
6,132,326
Members
449,719
Latest member
excel4mac

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top