Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I think you mean worksheet textboxes.
Try this Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim fBackwards As Boolean Const ctlPrev As String = "TextBox3" Const ctlNext As String = "TextBox2" Select Case KeyCode Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False 'Determine forwards or backwards fBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) 'In Excel 97 must select cell before activating another control If Application.Version < 9 Then ActiveSheet.Range("A1").Select 'Activate the appropriate control based on key(s) pressed If fBackwards Then ActiveSheet.OLEObjects(ctlPrev).Activate Else ActiveSheet.OLEObjects(ctlNext).Activate End If Application.ScreenUpdating = True End Select End Sub Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim fBackwards As Boolean Const ctlPrev As String = "TextBox1" Const ctlNext As String = "TextBox3" Select Case KeyCode Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False 'Determine forwards or backwards fBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) 'In Excel 97 must select cell before activating another control If Application.Version < 9 Then ActiveSheet.Range("A1").Select 'Activate the appropriate control based on key(s) pressed If fBackwards Then ActiveSheet.OLEObjects(ctlPrev).Activate Else ActiveSheet.OLEObjects(ctlNext).Activate End If Application.ScreenUpdating = True End Select End Sub Private Sub TextBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _ ByVal Shift As Integer) Dim fBackwards As Boolean Const ctlPrev As String = "TextBox2" Const ctlNext As String = "TextBox1" Select Case KeyCode Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False 'Determine forwards or backwards fBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) 'In Excel 97 must select cell before activating another control If Application.Version < 9 Then ActiveSheet.Range("A1").Select 'Activate the appropriate control based on key(s) pressed If fBackwards Then ActiveSheet.OLEObjects(ctlPrev).Activate Else ActiveSheet.OLEObjects(ctlNext).Activate End If Application.ScreenUpdating = True End Select End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. Add similar code for each control. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "DC" wrote in message ... Ive created a form in Excel 2000 that uses text boxes and im attempting to enable tabbing form box to box. Help!! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using text for the range in AVERAGE function | Excel Worksheet Functions | |||
Are there Rich Text Text Boxes | Excel Discussion (Misc queries) | |||
numerical integration | Excel Discussion (Misc queries) | |||
Custom functions calculating time arguments Help Desperate | Excel Worksheet Functions | |||
text function | Excel Worksheet Functions |