vba 如何在excel中找到已分配给对象的宏名称

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21566821/
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-12 01:44:37  来源:igfitidea点击:

how to find what macro name has been assigned to an object in excel

excelexcel-vbaobjectvba

提问by user3273242

I'm working on a spread sheet that someone else created and am having trouble in identifying which macros are assigned to the different objects. When I right click to :assign", it doesn't tell me what is already assigned. Is there a way to find out?

我正在处理其他人创建的电子表格,但无法确定将哪些宏分配给不同的对象。当我右键单击 :assign" 时,它没有告诉我已经分配了什么。有没有办法找出来?

回答by Simon1979

When you right click and select Assign Macroit should have the macro name already entered in the cell at the top, above the list of available macros. Alternatively clicking Editshould take you to the code. This works for Excel 2007 - you don't stipulate which you are using.

当您右键单击并选择Assign Macro它时,它应该已经在顶部的单元格中输入了宏名称,位于可用宏列表上方。或者,单击Edit应将您带到代码。这适用于 Excel 2007 - 您没有规定您使用的是哪个。

As a last resort, assuming you don't have masses and masses of macros, go to the VBE and put a break (click in the left margin to make it highlighted red) on the first line of each Sub/ Macro, then when you click the object it will take you to the VBE and highlight the line it stopped and thus the macro assigned.

作为最后的手段,假设您没有大量的宏,请转到 VBE 并在每个子 / 宏的第一行中断(单击左边距使其突出显示为红色),然后当您单击它会带您到 VBE 的对象并突出显示它停止的行,从而分配宏。

回答by Silenxor

If the objects the macro assigned to is grouped, excel doesn't show the macro assigned. Ungrouping objects will allow you to see which individual item actually has the macro assigned.

如果宏分配给的对象被分组,excel 不会显示分配的宏。取消组合对象将允许您查看实际分配了宏的单个项目。