View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Damien McBain Damien McBain is offline
external usenet poster
 
Posts: 14
Default onclick event for cell

This works (in the "before double click" even for the sheet):

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Selection = Range("A1") Then
'selection is always what you are double clicking coz you
'always select it by clicking once before you double click it
MsgBox "it works"
Else
End If
End Sub

HTH,

Damo


ties wrote:
I would like to add a OnClick event to a cell using VBA: A user clicks
certain cell and then for instance a form pops up. I'm not sure if
it's possible.

So far I have used Workbook_SheetSelectionChange, with which I can
monitor whether a cell is selected... This works pretty well, but it
also reacts when a user is scrolling the cursor with the arrow-keys
over the cell and offcourse doesn't react when the cell is already
selected and the user clicks the cell.

Does anyone know an easier solution than the one I found, which
covers the problems I encounter?

Thanks for your help
Thijs van Bon