我正在使用具有近200个按钮的Excel VBA宏。我想在一个模块中使用click事件。
我已经看到我必须将事件更改为Public并使用:
调用userform1.commandbutton1_Click或userform1.commandbutton1_Click
我想用变量更改按钮的数量以使用循环,但我不知道该怎么做。
我能够做到这一点,我想改变按钮属性:
userform1.Controls(“commandbutton”&i).caption =“test”但它不适用于“_Click”
任何帮助是极大的赞赏
使用Value
控件的Button
属性:
Me.Controls("CommandButton" & i).Value = True