View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default Set Enter Key movement in a particular sheet

For simplicity's sake, we will keep all the code in one area: the Workbook's
code module. To put the code below into that area right-click on the Excel
icon just to the left of the word File in the main Excel menu toolbar and
choose [View Code] from the list that pops up. Copy and paste the code below
into it. Change the name of the special sheet within the two sections of
code where it is used.

you can use any of these as direction indicators:
xlToLeft
xlToRight
xlUp
xlDown

Now for the code:

Private Sub Workbook_Activate()
If ActiveSheet.Name = "SpecialSheetName" Then ' change sheet name as
required
Application.MoveAfterReturnDirection = xlToRight ' for this sheet only
End If
End Sub

Private Sub Workbook_Deactivate()
Application.MoveAfterReturnDirection = xlDown ' back to default
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If ActiveSheet.Name = "SpecialSheetName" Then ' change sheet name as
required
Application.MoveAfterReturnDirection = xlToRight ' for this sheet only
Else
Application.MoveAfterReturnDirection = xlDown ' for all other sheets
End If
End Sub


"Rao Ratan Singh" wrote:

Hi all,
I want to set direction for after pressing enter in a particular worksheet.
But when i open new or another files this should work as default as previous.

Is there any way.

Regards

Rao Ratan Singh