Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Tab Order Problem

Greetings,

I have a UserForm with 14 TextBoxes (TB1 - TB14) and 1 CheckBox
(CBX1). The tab order is: TB1, TB2, TB3, TB4, TB5, TB6, CBX1, TB7,
TB8, TB9, TB10, TB11, TB12, TB13, TB14. I can use the Enter key to
get to CBX1 and then I can't get any further (the tab key does work
but I would rather not). Is there something different about the
CheckBox that wont allow the Enter key to advance the focus to the
next TextBox?

Any ideas on how to get this to work?

TIA

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Tab Order Problem

I guess that is because the typical interaction with a checkbox is not using
the enter key. You can manage it in code:

Private Sub CheckBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox1.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

Private Sub CheckBox2_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox2.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

Private Sub CheckBox3_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox3.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

--
Regards,
Tom Ogilvy



"Minitman" wrote in message
...
Greetings,

I have a UserForm with 14 TextBoxes (TB1 - TB14) and 1 CheckBox
(CBX1). The tab order is: TB1, TB2, TB3, TB4, TB5, TB6, CBX1, TB7,
TB8, TB9, TB10, TB11, TB12, TB13, TB14. I can use the Enter key to
get to CBX1 and then I can't get any further (the tab key does work
but I would rather not). Is there something different about the
CheckBox that wont allow the Enter key to advance the focus to the
next TextBox?

Any ideas on how to get this to work?

TIA

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Tab Order Problem

Hey Tom,

I just tried 1 of these subs and after DIMing the 2 variables (tIdex
and ctrl), it works great.

Thanks.

-Minitman

On Sun, 24 Oct 2004 19:42:46 -0400, "Tom Ogilvy"
wrote:

I guess that is because the typical interaction with a checkbox is not using
the enter key. You can manage it in code:

Private Sub CheckBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox1.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

Private Sub CheckBox2_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox2.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

Private Sub CheckBox3_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox3.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Tab Order Problem

Depends on whether you have option explicit or not. If not, works great
without dimming, but it is usually better to have it and dim them.

--
Regards,
Tom Ogilvy

"Minitman" wrote in message
...
Hey Tom,

I just tried 1 of these subs and after DIMing the 2 variables (tIdex
and ctrl), it works great.

Thanks.

-Minitman

On Sun, 24 Oct 2004 19:42:46 -0400, "Tom Ogilvy"
wrote:

I guess that is because the typical interaction with a checkbox is not

using
the enter key. You can manage it in code:

Private Sub CheckBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox1.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

Private Sub CheckBox2_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox2.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub

Private Sub CheckBox3_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
tIdex = CheckBox3.TabIndex + 1
If tIdex = Me.Controls.Count Then
tIdex = 0
End If
For Each ctrl In Me.Controls
If ctrl.TabIndex = tIdex Then
ctrl.SetFocus
Exit For
End If
Next
End If
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Tab Order Problem

I Do and I did. <G

-Minitman

On Mon, 25 Oct 2004 09:22:50 -0400, "Tom Ogilvy"
wrote:

Depends on whether you have option explicit or not. If not, works great
without dimming, but it is usually better to have it and dim them.


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
For chart syles, why doesn't color order match series order? AMiller Charts and Charting in Excel 1 October 29th 09 12:02 AM
Tough problem adding cells from different sheets, in random order Darcy Excel Worksheet Functions 4 January 8th 09 09:41 PM
How stop Excel file UK date order changing to US order in m.merge Roger Aldridge Excel Discussion (Misc queries) 1 October 9th 07 11:52 PM
Daily Macro to Download Data, Order and paste in order Iarla Excel Worksheet Functions 1 November 17th 04 01:59 PM
Tab Order Code Problem Ryan Excel Programming 3 April 19th 04 05:01 PM


All times are GMT +1. The time now is 12:39 PM.

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"