ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Setting custom Tab order (https://www.excelbanter.com/setting-up-configuration-excel/143038-setting-custom-tab-order.html)

Rusty

Setting custom Tab order
 
I am building a form in Excel 2003. I want to be able to hit the tab key (or
any key / combination of keys) to automatically move to the next input field
in the form. Is it possible to create a custom tab order or to create a
macro to do this for me? If yes, can you help me do it or at least point me
in the right direction?

Thanks a ton for your help!

Rusty

Bob Phillips

Setting custom Tab order
 
All you need to do is to unlock the cells you want to move into
(FormatCellsProtection), and protect the worksheet.

If you want some exotic order regardless, see
http://xldynamic.com/source/xld.xlFAQ0008.html

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Rusty" wrote in message
...
I am building a form in Excel 2003. I want to be able to hit the tab key
(or
any key / combination of keys) to automatically move to the next input
field
in the form. Is it possible to create a custom tab order or to create a
macro to do this for me? If yes, can you help me do it or at least point
me
in the right direction?

Thanks a ton for your help!

Rusty




Gord Dibben

Setting custom Tab order
 
Rusty

If any of these options at Bob's site aren't what you want, you can use VBA
event code to leap from cell to cell in the order you want as you enter data.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

Or this more robust code from Anne Troy.

Private Sub Worksheet_Change(ByVal Target As Range)
'Anne Troy 's taborder event code
Dim aTabOrd As Variant
Dim i As Long

'Set the tab order of input cells
aTabOrd = Array("A5", "B5", "C5", "A10", "B10", "C10")

'Loop through the array of cell address
For i = LBound(aTabOrd) To UBound(aTabOrd)
'If the cell that's changed is in the array
If aTabOrd(i) = Target.Address(0, 0) Then
'If the cell that's changed is the last in the array
If i = UBound(aTabOrd) Then
'Select first cell in the array
Me.Range(aTabOrd(LBound(aTabOrd))).Select
Else
'Select next cell in the array
Me.Range(aTabOrd(i + 1)).Select
End If
End If
Next i

End Sub


Gord Dibben MS Excel MVP

On Wed, 16 May 2007 21:47:01 -0700, Rusty
wrote:

I am building a form in Excel 2003. I want to be able to hit the tab key (or
any key / combination of keys) to automatically move to the next input field
in the form. Is it possible to create a custom tab order or to create a
macro to do this for me? If yes, can you help me do it or at least point me
in the right direction?

Thanks a ton for your help!

Rusty




All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com