LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Shift-tab in keydown event

Hi,

I have a userform with a bunch of textboxes, checkboxes, etc. I want
to allow the user to navigate through the controls using tab/shift-tab
OR Enter/arrow keys. Specifically, I would like Enter, right arrow,
or down arrow to equal a tab, and left arrow or up arrow to equal a
shift-tab. Here is my code:

Private Sub cmdButton_KeyDown(ByVal KeyCode As MSForms.ReturnInteger,
ByVal Shift As Integer)
If KeyCode = 13 Or KeyCode = 39 Or KeyCode = 40 Then KeyCode = 9
If KeyCode = 37 Or KeyCode = 38 Then
Shift=1 and KeyCode=9
'SendKeys "+{TAB}"
End If
End Sub

The first If statement works fine, but the second does not. I imagine
the problem relates to the fact that Shift is not a return integer,
like KeyCode, but the SendKeys statement that is commented out didn't
work either. How can I return a shift-tab using KeyCode, or is there
a better way to accomplish my goal?

Thanks!
 
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
keydown event Peter T Excel Programming 0 April 18th 05 02:03 PM
keydown event K Dales[_2_] Excel Programming 0 April 18th 05 12:46 PM
user form-on open event? keydown event? FSt1[_3_] Excel Programming 2 August 5th 04 02:26 PM
keydown event jim c. Excel Programming 1 October 10th 03 03:16 AM


All times are GMT +1. The time now is 09:01 AM.

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

About Us

"It's about Microsoft Excel"