Thanks for the reply.
I have this so far:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If ActiveCell.Row = 3 Or ActiveCell.Row = 4 Then
If ActiveCell.Column >= 2 And ActiveCell.Column <= 8 Then
Application.OnKey "{ENTER}", NextCol
End If
End If
End Sub
Public Function NextCol()
'If ActiveCell.Row = 3 Then
Select Case ActiveCell.Column
Case 2, 6, 8
ActiveCell.Offset(0, 1).Select
Case 3, 4, 5
ActiveCell.Offset(0, 1).Select
Case 9
MsgBox "add to new row"
End Select
It seems to work, except for which "enter" that is pressed.
If it is the numpad 'enter' then it works but on the main keyboard
when pressing "Enter" the cursor moves up one cell, so now I have to
check which "Enter" has been pressed.
Unless there is a way to make both "Enter" ebhave the same way on this
workbook only?
Thanks for any help.
> For the cursor movement, you would probably have to use the Worksheet_Change
> event and make it conditional for the range of cells where you want to apply
[quoted text clipped - 43 lines]
>
> > Thanks
JLGWhiz - 26 May 2008 04:25 GMT
This might not satisfy your needs but this is more what I had in mind. The
problem with this is that it does not immediately change direction on the
first keystroke for Enter. It takes effect on the second keystroke.
However, it will continue to move to the right until you move the cursor
outside the target area and make a change to a cell. This sets the direction
to down if it is outside the target area, but you can easily change it to any
other direction. The options are:
xlUp, xlDown, xlToLeft and xlToRight.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set Target = Intersect(Target, Range("B3:H4"))
If Not Target Is Nothing Then
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight
Else
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown
End If
End Sub
> Thanks for the reply.
>
[quoted text clipped - 76 lines]
> >
> > > Thanks
HammerJoe@gmail.com - 26 May 2008 05:28 GMT
This is not working for me...
The issue is that when the Worksheet_Change is called the cursor might
not be in the correct cell anymore.
What I need is when that SUB is called is to have the Cell that has
changed and then move the cursor from there.
Another issue is that Application.OnKey "{ENTER}", NextCol still calls
NextCol even if a cursor key (Right) is used??
Why is that?
A simple thing is turning into a complete frustration for me...
On May 26, 12:25 am, JLGWhiz <JLGW...@discussions.microsoft.com>
wrote:
> This might not satisfy your needs but this is more what I had in mind. The
> problem with this is that it does not immediately change direction on the
[quoted text clipped - 98 lines]
>
> > > > Thanks
JLGWhiz - 26 May 2008 15:34 GMT
This is a clunge to force the cursor to the right when a change is made
within the designated range. It move right ONLY if there is a change.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set Target = Intersect(Target, Range("B3:H4"))
If Not Target Is Nothing Then
ActiveCell.Offset(-1, 1).Activate
End If
End Sub
I think it is about as close as I can get to what you want.
> This is not working for me...
>
[quoted text clipped - 113 lines]
> >
> > > > > Thanks
JLGWhiz - 26 May 2008 15:40 GMT
This might work better.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set Target = Intersect(Target, Range("B3:H4"))
If Not Target Is Nothing Then
Target.Offset(0, 1).Activate
End If
End Sub
> This is not working for me...
>
[quoted text clipped - 113 lines]
> >
> > > > > Thanks