View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Determine Shift Key Press

Todd

Where? On a sheet? Try this

Dim ShiftKeyPress As Boolean

Private Sub CommandButton1_Click()
If ShiftKeyPress Then
MsgBox "Shift key is pressed"
Else
MsgBox "Shift key is not pressed"
End If

End Sub

Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)

ShiftKeyPress = True
End Sub

Private Sub CommandButton1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)

ShiftKeyPress = False
End Sub

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Todd Huttenstine" wrote in message
...
Hey guys

I want to be able to click CommandButton1 and if it
detects that I was holding the "Shift" key down during the
click, it give me a msgbox saying "Shift Key Pressed".

How do I do this?

Thank you
Todd Huttenstine