Thread: BIG question
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default BIG question

I believe this shorter code will function identically to the code you
posted...

Private Sub Worksheet_Change(ByVal Target As Range)
' Set the tab order of input cells in a space delimited list
Const aTabOrd As String = "A5 B22 C5 A11 D10 F7"
On Error Resume Next
Range(Trim(Split(Split(aTabOrd & " " & aTabOrd, Target.Address(0, 0) _
& " ", , vbTextCompare)(1))(0))).Select
End Sub

--
Rick (MVP - Excel)


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
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", "B22", "C5", "A11", "D10", "F7")

'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 Sat, 13 Jun 2009 17:33:01 -0700, Wu
wrote:


But I need not only move to right.

How to write the marco to move to specified direction after [ENTER], such
as
move down , move up...............



"Max" wrote:

Think you can just change the setting to suit ..
Click Tools Options Edit tab
Select as desired from the droplist for "Move selection after Enter",
ie select: Right, then OK out

Voila? Express it, click the YES button below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:25,000 Files:300 Subscribers:70
xdemechanik
---
"Wu" wrote:
I would like to write a marco that:

Let me input data in a cell, and when I [ENTER], the cursor will move
to
right cell to let me input data again..................