ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Is it possible run code when a cell is doubleclicked? (https://www.excelbanter.com/excel-worksheet-functions/131067-possible-run-code-when-cell-doubleclicked.html)

sumGirl

Is it possible run code when a cell is doubleclicked?
 
Is it possible run code when a cell is doubleclicked?


Sandy Mann

Is it possible run code when a cell is doubleclicked?
 
See your other post in microsoft.excel.

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


with @tiscali.co.uk


"sumGirl" wrote in message
oups.com...
Is it possible run code when a cell is doubleclicked?




Mike

Is it possible run code when a cell is doubleclicked?
 
You can't call a macro from a cell with something like

=if(a11,domymacro)

But you can trap event such as double clicking on a sheet using:-

Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
msg = "You double clicked"
MsgBox (msg)
End Sub

You could also use the sheet change event to detect the change of a
particular cell and call a macro

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
If Target.Value "" Then
msg = "You changed A1"
MsgBox (msg)
End If
End If
End Sub


Mike
"sumGirl" wrote:

Is it possible run code when a cell is doubleclicked?




All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com