简体   繁体   中英

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?

Correct is

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM