右键单击事件错误
Right Click event error
我创建的右键单击事件显示错误消息"Procedure declaration does not match description of event or procedure having the same name"。
我的目标是右键单击一个单元格并将来自另一个 sheet 的列的计数输入目标单元格。
我遗漏了什么错误?
Sub Worksheet_BeforeRightClick(ByVal Target As Range)
Dim wb As Workbook
Dim i As Long
Set wb = Workbooks("Calc.xlsm")
EventState = Application.EnableEvents
Application.EnableEvents = True
Target.Address = Application.count(wb.Sheets("Carrier").Range("O:O"))
End Sub
错误信息很清楚。您的事件处理程序的原型不等于 Excel 想要的样子。将其更改为:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
您不能更改事件处理程序的签名。
我创建的右键单击事件显示错误消息"Procedure declaration does not match description of event or procedure having the same name"。
我的目标是右键单击一个单元格并将来自另一个 sheet 的列的计数输入目标单元格。
我遗漏了什么错误?
Sub Worksheet_BeforeRightClick(ByVal Target As Range)
Dim wb As Workbook
Dim i As Long
Set wb = Workbooks("Calc.xlsm")
EventState = Application.EnableEvents
Application.EnableEvents = True
Target.Address = Application.count(wb.Sheets("Carrier").Range("O:O"))
End Sub
错误信息很清楚。您的事件处理程序的原型不等于 Excel 想要的样子。将其更改为:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
您不能更改事件处理程序的签名。