CivilSigma
CivilSigma

Reputation: 179

Executing multiple modules using a button in Excel VBA

I am trying to execute two module sub in excel VBA through a third module, through a button.

The subs are defined in unique module files as:

Public Sub MinPenCheck()

'code here, if statements, variables etc. 

End Sub

And:

Public Sub InputCheck()

'code here, if statements, variables etc. 

End Sub

I defined a third module as follows:

Public Sub DesignCheck()
   Call InputCheck 'Macro1
   Call MinPenCheck 'Macro2
End Sub

And I inputed a button in my spreadsheet, assigning the above macro to it. When I press the button, the other two modules are not executing. I am getting the error "Expected variable or procedure, not module".

How can I achieve this?

Upvotes: 1

Views: 5145

Answers (1)

Ronan Vico
Ronan Vico

Reputation: 605

Correct is

Public Sub DesignCheck()
   Call InputCheck.InputCheck() 'Macro1
   Call MinPenCheck.MinPenCheck() 'Macro2
End Sub

Upvotes: 2

Related Questions