![]() |
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! |
All times are GMT +1. The time now is 07:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com