在excel-2007中,我有一个宏,当双击一个单元格时,会打开一个表单。
当相关单元格位于表单将出现的范围内时,会在表单中执行不希望的选择。
我怎样才能避免这种选择?
来自 hammejdp 对 barrowc 的回答的建议编辑:
我已经使用了这个(即 BeforeDoubleClick 事件)但没有解决问题
Private Sub Workbook_SheetBeforeDoubleClick(ByVal sh As Object, ByVal target As Range, cancel As Boolean)
Call s_Click_DoubleClick(sh, target, cancel)
End Sub
Private Sub Workbook_SheetBeforeRightClick(ByVal sh As Object, ByVal target As Range, cancel As Boolean)
Call s_Click_DoubleClick(sh, target, cancel)
End Sub
Private Sub s_Click_DoubleClick(sh, target, cancel)
Application.ScreenUpdating = False
If sh.Name <> "Legende" Then
cancel = True
' Maak gebruik van een range
vRowCount = target.Rows.Count
vColumnCount = target.Columns.Count
f_Input.TextBox1.Value = vColumnCount