• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Moving cursor to Left when i press enter

usmanhere

New Member
Please guide how to move cursor to left when i press enter after having entered the Data. Please note that this must be only for particular sheet and not for the whole Excel.
 
Sir, I am not a VBA expert, but can you please try this.


Application.MoveAfterReturnDirection = xlToLeft


Please take an expert opnion before implementing.
 
Hi Usman ,


Since you want it only for one particular sheet , you will need to do the following :

[pre]
Code:
Private Sub Worksheet_Activate()
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlToRight
End Sub

Private Sub Worksheet_Deactivate()
Application.MoveAfterReturn = True
Application.MoveAfterReturnDirection = xlDown ' I assume this is your default direction
End Sub

Incorporate the above code in the section pertaining to the sheet where you want this to happen e.g. if you want this only in Sheet4 , then put this code in the section for Sheet4 in your VBA Project Explorer.


If your normal action is not to move the cursor when the ENTER key is pressed , then , in the Deactivate procedure , instead of the two given lines , use only the following line :


Application.MoveAfterReturn = False
[/pre]
Narayan
 
Back
Top