After Enter in a cell

  • Thread starter Thread starter Lars Kofod
  • Start date Start date
L

Lars Kofod

When you have entered numbers or text in a cell, and pres
enter, the cellpointer move up or down, left or right or
nowhere. How can I find out what it does from VBA. What
property do I look for?

Thank you
Lars Kofod
 
If you record a macro it will only give you the address you went to.
If you want to control where it goes in a macro use OFFSET

range("a1").offset(1,4).select
 
Hi Lars,

The MoveAfterReturn and MoveAfterReturnDirection properties (of the
Application object) will give you what you're looking for:

Public Function gsMoveAfterReturn() As String
If Application.MoveAfterReturn Then
Select Case Application.MoveAfterReturnDirection
Case xlDown
gsMoveAfterReturn = "Down"
Case xlUp
gsMoveAfterReturn = "Up"
Case xlToLeft
gsMoveAfterReturn = "Left"
Case xlToRight
gsMoveAfterReturn = "Right"
End Select
End If
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Back
Top