View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How can we control the sequence in which the cursor moves in a

Right-click on the sheet tab and "View Code"

Copy/paste the code into that module. Edit as required.

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", "B1", "G3", "A11", "B10", "C3")
On Error GoTo enditall
Application.EnableEvents = False

'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
enditall:
Application.EnableEvents = True

End Sub


Gord

On Sun, 27 Jan 2008 13:36:01 -0800, Mandigos
wrote:

Gord,
appreciate your help. Yes, I am interested in using event code. thx Mandigos

"Gord Dibben" wrote:

All depends upon the order in which you want to move.

There are a few methods of achieving this.

See Bob Phillips's site for a couple.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

You could also employ event code to jump around to non-contiguous random cells.

If interested, post back.


Gord Dibben MS Excel MVP


On Sun, 27 Jan 2008 12:54:01 -0800, Mandigos
wrote:

I have created a form using excel and need to force the cursor to jump from
input cell to input cell in a specific order, how do I achieve this? I have
tried all sorts of things, but so far, excel has the control of the cursor
and moves widely through the form. Appreciate any assistance. Thx Mandigos