VBA – MouseDown和MouseUp触发macros
我已经看到了一些代码,可以很好地捕获TextBoxes,Shapes,CommandButtons等中的MouseDown和MouseUp事件,如下所示:
Private Sub CommandButton1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) 'Do Stuff End Sub
有什么办法来捕获工作表上的MouseDown和MouseUp事件,以触发macros?
如果你在一般的用户表单中谈论,那么你可以使用这样的格式:
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) 'Do things here End Sub
我不相信它可以与工作表一起工作。