View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mike K Mike K is offline
external usenet poster
 
Posts: 104
Default Code not working to move cursor down on Enter.

Oh Wise Ones,

I just need the curser to move down when I press enter, only when inside a
set range on a set workbook/worksheet, and move to the right all other
times.

From JLGWhiz-

First I tied this:

Set MyRange = ActiveSheet.Range("J3:L12")
If Intersect(MyRange, Target) Then
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown
Else
Application.MoveAfterReturnDirection = xlToRight
End If

Did not do anything, still moved to the right.

Then I tried this from another post:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set Target = Intersect(Target, Range("J3:L12"))
If Not Target Is Nothing Then
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight
Else
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown
End If
End Sub

Did not work either, got an error when it was placed in a module.

Any suggestions?

Thanks,
Mike