gpt4 book ai didi

excel - 使用 Excel VBA 中的按钮执行多个模块

转载 作者:行者123 更新时间:2023-12-04 22:23:22 38 4
gpt4 key购买 nike

我正在尝试通过一个按钮通过第三个模块在 excel VBA 中执行两个模块子。

潜艇在独特的模块文件中定义为:

Public Sub MinPenCheck()

'code here, if statements, variables etc.

End Sub

和:
Public Sub InputCheck()

'code here, if statements, variables etc.

End Sub

我定义了第三个模块如下:
Public Sub DesignCheck()
Call InputCheck 'Macro1
Call MinPenCheck 'Macro2
End Sub

我在电子表格中输入了一个按钮,将上述宏分配给它。当我按下按钮时,其他两个模块没有执行。我收到错误“预期的变量或过程,而不是模块”。

我怎样才能做到这一点?

最佳答案

正确的是

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

关于excel - 使用 Excel VBA 中的按钮执行多个模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60496399/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com