D
deltree
Hey all,
I am having trouble with the tab orders in Excel 2000. I am using the
following sub (in VB, it is in the code section of the ThisWorkbook
module under Excel Objects) to call "TabOrder", a sub I wrote to set
the tab order on one particular sheet.
<VB>
Private Sub Workbook_Activate()
Application.OnKey "{TAB}", "TabOrder"
End Sub
</VB>
Setting the tab order works fine. But I cannot figure out how to
restore the default tab settings to Excel, so that when the user hits
<tab>, it advances the focus one cell to the right.
My QUESTION is, how do you properly restore the tab key's default
functionality??
The following subroutines are my two attempts to restore the tab key's
default functionality. But these solutions had some undesirable side
effects.
1. This sub deactivates the <tab> key for the entire application, so
that hitting <tab> no longer calls my "TabOrder" sub. But this sub does
not restore the default functionality to <tab>, which is to move one
cell to the right. Hitting <tab> does nothing after this deactivation.
<VB>
Private Sub Workbook_Deactivate()
Application.OnKey "{TAB}", ""
End Sub
</VB>
2. To reset the <tab> key's normal functionality, I set the
Workbook_Deactivate() sub to call this TabOrderDefault sub whenever the
tab key is pressed. The problem with this solution is that any other
workbook has to open up this workbook to access its macro. This is also
unacceptable.
<VB>
Sub TabOrderDefault()
ActiveCell.Offset(0, 1).Select
End Sub
</VB>
Any helpful hints or insights would be appreciated by this Excel
novice.
Thanks!
I am having trouble with the tab orders in Excel 2000. I am using the
following sub (in VB, it is in the code section of the ThisWorkbook
module under Excel Objects) to call "TabOrder", a sub I wrote to set
the tab order on one particular sheet.
<VB>
Private Sub Workbook_Activate()
Application.OnKey "{TAB}", "TabOrder"
End Sub
</VB>
Setting the tab order works fine. But I cannot figure out how to
restore the default tab settings to Excel, so that when the user hits
<tab>, it advances the focus one cell to the right.
My QUESTION is, how do you properly restore the tab key's default
functionality??
The following subroutines are my two attempts to restore the tab key's
default functionality. But these solutions had some undesirable side
effects.
1. This sub deactivates the <tab> key for the entire application, so
that hitting <tab> no longer calls my "TabOrder" sub. But this sub does
not restore the default functionality to <tab>, which is to move one
cell to the right. Hitting <tab> does nothing after this deactivation.
<VB>
Private Sub Workbook_Deactivate()
Application.OnKey "{TAB}", ""
End Sub
</VB>
2. To reset the <tab> key's normal functionality, I set the
Workbook_Deactivate() sub to call this TabOrderDefault sub whenever the
tab key is pressed. The problem with this solution is that any other
workbook has to open up this workbook to access its macro. This is also
unacceptable.
<VB>
Sub TabOrderDefault()
ActiveCell.Offset(0, 1).Select
End Sub
</VB>
Any helpful hints or insights would be appreciated by this Excel
novice.
Thanks!