View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Is it possible run code when a cell is doubleclicked?

If Target.Address = "$B$5" Then
'do something
End If


You probably want to set Cancel = True in this code:

If Target.Address = "$B$5" Then
'do something
Cancel = True
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"merjet" wrote in message
ps.com...
Yes. Suppose you want the code to run if the user clicks on cell B5.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Target.Address = "$B$5" Then
'do something
End If
End Sub

In he VB Editor put this in the worksheet's module.

Hth,
Merjet