Is there a double click event for cell?

  • Thread starter Thread starter Ayo
  • Start date Start date
A

Ayo

I am looking for a function that would perform a set of actions when I double
click a cell in a worksheet. I know there is something like this in Access.
 
You would use the BeforeDoubleClick event of the worksheet and use the
Target argument (cell double clicked is passed into the event procedure via
this argument) to filter on the cell you are interested in.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Address = "$C$8" Then
'
' Cell C8 was double clicked
' Put your code for it here
'
End If
End Sub

Note: Double clicking a cell usually puts Excel into edit mode within that
cell. If you don't want that to happen, set the Cancel argument to True.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Address = "$C$8" Then
Cancel = True
'
' Cell C8 was double clicked
' Put your code for it here
'
End If
End Sub


Rick
 
To get to the sheet module for this macro, right click sheet tab>view
code>copy/paste it
 
Thanks Don.

Don Guillett said:
To get to the sheet module for this macro, right click sheet tab>view
code>copy/paste it
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top