View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Excel Curious Excel Curious is offline
external usenet poster
 
Posts: 23
Default Problem using tab in TextBoxes not in Userform

I've got six control Text boxes (TextBox1...TextBox6) they are NOT in a user
form. I want to be able to Tab between them and was trying to use the
following code, but found that it only worked for the first item and
thereafter I'd have to go in and "click" on the next text box to select it
before I could tab again to the next. Somehow the second use of the KeyDown
is not working as I thought.


Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Dim fldTemp

If KeyCode = 9 Then
TextBox2.Activate
End If
End Sub

Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
Dim fldTemp

If KeyCode = 9 Then
TextBox3.Activate
End If
End Sub

....and so on.