P
PO
Hi
I have a worksheet containing 22 textboxes. They don't seem to have a built
in tab-function. I've tried to use the key_down sub:
Private Sub TextBox01_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 9 or KeyCode = 13 Then TextBox02.Activate
End Sub
I don't want to copy the code 22 times (for all 22 textboxes - the code
quickly get unreadable), there must be a way to capture the keystrokes in
one event and then call a public sub with the textbox name as an
argument...for instance:
Sub Tabhandler(ByVal TextBoxName as String)
Dim strNr as String
strNr=Right(TextBoxName,2)
strNr=StrNr+1
ActiveSheet.Shapes(strNr).SetFocus
End Sub
I just want the user to be able to tab between all the textboxes in my
worksheet.
Perhaps there are other solutions to this problem?
TIA
PO
I have a worksheet containing 22 textboxes. They don't seem to have a built
in tab-function. I've tried to use the key_down sub:
Private Sub TextBox01_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 9 or KeyCode = 13 Then TextBox02.Activate
End Sub
I don't want to copy the code 22 times (for all 22 textboxes - the code
quickly get unreadable), there must be a way to capture the keystrokes in
one event and then call a public sub with the textbox name as an
argument...for instance:
Sub Tabhandler(ByVal TextBoxName as String)
Dim strNr as String
strNr=Right(TextBoxName,2)
strNr=StrNr+1
ActiveSheet.Shapes(strNr).SetFocus
End Sub
I just want the user to be able to tab between all the textboxes in my
worksheet.
Perhaps there are other solutions to this problem?
TIA
PO