如何将VBA宏与Excel中的按钮进行绑定 [英] How can I tie a VBA macro to a button in Excel
本文介绍了如何将VBA宏与Excel中的按钮进行绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经创建了一个宏和一个按钮,但是我看不到在哪里编辑按钮设置来调用宏。我正在使用Excel 2003。
I have created a macro and a button but I can't see where to edit the button setting to invoke the macro. I'm using Excel 2003.
推荐答案
如果您使用了表单控件。将按钮添加到工作表后,分配宏的机会就会出现。或者,如果按钮已经在工作表上,您可以右键单击它,然后选择分配宏。
If you've used a Form Control. The chance to assign a macro will come up right after you add the button to the sheet. Or, if the button is already on the sheet, you can right-click on it and select Assign Macro.
如果您使用ActiveXControl,请右键单击按钮并选择查看代码。这将打开VBE与
If you've used an ActiveXControl, right-click on the button and select View Code. This will open up the VBE with
Private Sub myCommandButtonName_Click()
End Sub
从这个子调用你的宏如此...
From this sub call your macro like so...
Private Sub myCommandButtonName_Click()
Call myMacro
End Sub
这篇关于如何将VBA宏与Excel中的按钮进行绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文