Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key modifier for double-click event?
Is it possible to detect if a key is held down during th
BeforeDoubleClick event? I want to be able to change a cell with a double-click, but no interfere with the normal edit formula default functionality. I want t be able to hold down the CTRL key while double-clicking the cell to ge different behavior. Is this possible? TIA, - -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Key modifier for double-click event?
Byrt,
I believe you are going to have to use a key other than the Ctrl or Shift key. The Alt key will work... '1. Place the following line of code at the top of a general module: Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer '2. Then your code in the double click event for the sheet could look like this: '-------------------------------------------- Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If GetKeyState(18) < 0 Then 'more code MsgBox "Alt key is down" Else 'more code MsgBox "Alt key is up" End If Cancel = True End Sub '--------------------------------------------- The Shift key is "16", the Ctrl key is "17" and the Alt key is "18". Regards, Jim Cone San Francisco, CA "Byrt Martinez " wrote in message ... Is it possible to detect if a key is held down during the BeforeDoubleClick event? I want to be able to change a cell with a double-click, but not interfere with the normal edit formula default functionality. I want to be able to hold down the CTRL key while double-clicking the cell to get different behavior. Is this possible? TIA, -B |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to use selection change instead of double click event? | Excel Discussion (Misc queries) | |||
How to change syperlink from single click to double click | Excel Worksheet Functions | |||
Is there a double click event for cell? | Excel Discussion (Misc queries) | |||
Click on graph bar to execute a double-click in a pivot table cell | Charts and Charting in Excel | |||
Before Double Click Event | Excel Programming |