Excel 2010 - Error: Cannot run the macro SelectCell using .onAction

后端 未结 2 838
星月不相逢
星月不相逢 2021-01-22 01:47

I have been looking all over the internet for a solution to this problem but for some reason I can never find anything directly related to using .onAction with selecting a speci

2条回答
  •  感动是毒
    2021-01-22 02:15

    If I'm reading this right, "SelectCell" is a macro name, and you're passing in "Sheet 1","$C$10" as parameters (as strings). Whenever you make a call on the right side of an assignment operator (equals sign) the parameters need to be passed in with parenthases. for example,

    .OnAction = "SelectCell "Sheet 1","$C$10""
    

    is wrong, and

    .OnAction = "SelectCell ("Sheet 1","$C$10")"
    

    is right.

    Try that, but there's not much I can go off without much code. You could also try to use the fully qualified macro name, in case the Macro is in another module.

提交回复
热议问题