当Application.Caller只是返回一个错误时如何获得点击button的行数?

有很多像我这样的问题,我只是尝试了很多地方提到的解决scheme,例如在这里 。 但是对于我来说,它只是返回错误“运行时错误'1004':无法获得工作表类的Buttons属性”当我input下面的代码:

Sub Mainscoresheet() ' Mainlineup Macro Dim b As Object, RowNumber As Integer Set b = ActiveSheet.Buttons(Application.Caller) 'here I get the error With b.TopLeftCell RowNumber = .Row End With MsgBox "Row Number " & RowNumber End Sub 

有谁知道另一个解决scheme,可以解决我的问题? 如果您需要更多信息,请随时询问。 提前致谢!

亲切的问候,朱莉娅

我testing了你的代码。 它可以正常使用formsbutton,但不能与ActiveXbutton一起使用。 这可能是问题吗?