View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Can you assign an "order" for cell entry?

Actually, with the following code, the movement out of the last cell will be
normal (that is, it will be in accordance with your "Move selection after
Enter" option on Tools/Options/Edit(tab) from Excel's menu bar.

Private Sub Worksheet_Change(ByVal Target As Range)
Const Addr = "D1 G10 A5 B7 C3"
With Target
If InStr(" " & Addr & " ", " " & .Address(False, False) & " ") Then
If .Address(False, False) < Mid$(Addr, InStrRev(Addr, " ") + 1) Then
Range(Split(Split(Addr & " " & .Address(False, False), _
.Address(False, False) & " ")(1))(0)).Select
End If
End If
End With
End Sub

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
This may do what you want. Right-click the worksheet tab (at the bottom of
the page) for the worksheet you want this functionality on and then select
View Code from the popup window. Copy/paste the following code into the
code window that opens up when you do that...

Private Sub Worksheet_Change(ByVal Target As Range)
Const Addr = "D1 G10 A5 B7 C3"
If InStr(" " & Addr & " ", " " & Target.Address(False, False) & " ") Then
Range(Split(Split(Addr & " " & Target.Address(False, False), _
Target.Address(False, False) & " ")(1))(0)).Select
End If
End Sub

Simply put the list of cell address (space delimited), in the order you
want them processed in, into the "Const Addr" statement in place of the
sample addresses I used. Now, go back to the worksheet, click in one of
those cell and edit it... pressing Return or Tab should take you to the
next cell in the list. You didn't say what you wanted to happen, so after
the last cell in the list is edited, that cell will remain the active cell
after Return or Tab are pressed. If you have a natural "parking area" for
your active cell, just put it at the end of the list.

Rick


"TheMilkGuy" wrote in message
...
Hi folks,

I have a sheet with a couple dozen input cells spread out over the
screen.

Is there a way to assign an order to them so that when a value is
entered and the Return key hit, the cell advances to the next chosen
cell?

I am sure there is a phrase for what I am feebly trying to describe...

Thanks,
Craig