Haw can i test if CTRL is activated (hold down) in VBA
Private Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer
Const VK_CONTROL As Integer = &H11 'Ctrl
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If GetKeyState(VK_CONTROL) < 0 Then Ctrl = True Else Ctrl = False
If Ctrl = True Then
MsgBox "pressed"
Else
MsgBox "Not"
End If
End Sub
all in the sheet module worked fine for me.
--
Regards,
Tom Ogilvy
"excelent" wrote in message
...
Great tanks Ron :-)
i wonder can i put this
If GetKeyState(VK_CONTROL) < 0 Then Ctrl = True Else Ctrl = False
If Ctrl = True Then
MsgBox "pressed"
Else
MsgBox "Not"
End If
in the Sheet event-module, or do i have to call it like u show it ?
and do i have to use the Declare Function too or is that just another
way to do the same ?
|