Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use selection change instead of double click event? ghost Excel Discussion (Misc queries) 1 December 26th 08 04:58 AM
How to change syperlink from single click to double click syperlinker Excel Worksheet Functions 0 June 13th 08 05:01 PM
Is there a double click event for cell? Ayo Excel Discussion (Misc queries) 3 June 6th 08 12:18 AM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM
Before Double Click Event gregork Excel Programming 4 February 9th 04 09:17 AM


All times are GMT +1. The time now is 05:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"