Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DC DC is offline
external usenet poster
 
Posts: 42
Default How do I enable the tab function between text boxes?

Ive created a form in Excel 2000 that uses text boxes and im attempting to
enable tabbing form box to box. Help!!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 318
Default How do I enable the tab function between text boxes?

Hi
You need to provide more info. The tabbing from one control to the other is
automatic. If the order is not correct, you start with the first control and
give it a tab index of 0 (In properties). Give the control you want to tab to
next the tab index of 1 and so on.


"DC" wrote:

Ive created a form in Excel 2000 that uses text boxes and im attempting to
enable tabbing form box to box. Help!!

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default How do I enable the tab function between text boxes?

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!!



Reply
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
Using text for the range in AVERAGE function [email protected] Excel Worksheet Functions 4 July 8th 06 12:00 PM
Are there Rich Text Text Boxes Emory @ CFW Excel Discussion (Misc queries) 1 May 31st 06 03:52 AM
numerical integration integreat Excel Discussion (Misc queries) 4 May 12th 06 02:40 AM
Custom functions calculating time arguments Help Desperate Bill_De Excel Worksheet Functions 12 April 25th 06 02:22 AM
text function ToddFisk Excel Worksheet Functions 2 September 9th 05 08:33 PM


All times are GMT +1. The time now is 02:28 AM.

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

About Us

"It's about Microsoft Excel"