View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Minitman[_4_] Minitman[_4_] is offline
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