1个回答
展开全部
请用工作表的 BeforeDoubleClick 事件:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = Range("A1") Then
userfomr1.Show
End If
End Sub
更多追问追答
追问
如果Private Sub Worksheet_SelectionChange(ByVal Target As Range)这个事件里要调用你上面写的事件的话,该怎么弄
追答
BeforeDoubleClick 事件的优先级高于 SelectionChange 事件
另外,之前的回答中写得不对,判断 Target 单元格时,直接写引用位置字符串就行了,如下:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$B$5" Then MsgBox "Hello!" '双击B5时,弹出窗口显示 HELLO
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$1" Then MsgBox "HAHA" '单击A1时,弹出窗口显示 HAHA
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |