vba 宏分配的按钮在 Excel 中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36612569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 10:21:04  来源:igfitidea点击:

Macro-assigned button does not work in Excel

excelvbaexcel-vba

提问by N. Pavon

I created a button and I assigned a macro to it. The button does not work, but if I run the macro manually by using the "run" option in the developer tab or if I press the "play" button in the VBA window, everything works perfectly. I do not think that adding the code will be useful.

我创建了一个按钮并为其分配了一个宏。该按钮不起作用,但如果我通过使用开发人员选项卡中的“运行”选项手动运行宏,或者如果我按下 VBA 窗口中的“播放”按钮,则一切正常。我不认为添加代码会有用。

Regards,

问候,

回答by Mathieu Guindon

It's possible the macro got "un-assigned".

宏可能“未分配”。

Right-click the button in design mode, and select "Assign Macro"

在设计模式下右键单击按钮,然后选择“分配宏”

"Assign Macro" dialog

“分配宏”对话框

Re-assign the macro in the dialog, exit design mode and click the button - it should "just work".

在对话框中重新分配宏,退出设计模式并单击按钮 - 它应该“正常工作”。