View Single Post
  #4   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

Instructions for Excel 97/2000/XP (2002)/2003 [NOT for Excel 2007]
Open the workbook that the code needs to go into.
RIGHT-click on the Excel icon to the left of the word File in the Excel menu
toolbar.
Choose [View Code] from the list that will appear when you do that.
Copy the code I provided in the earlier message and paste it into the code
module presented to you (large white area in the VB Editor).
Close the VB Editor.
Save your workbook.
Close and open your workbook, and it should operate well for you.

If you would rather, you may send me a copy of your workbook as an email
attachment to (remove spaces from this address)
HelpFrom @ jlathamsite.com
and I will put the code into it, test it and return it to you.


"Rao Ratan Singh" wrote:

Sir,
Thank lot for response. Bu i dont have good knowlege of macro and code, so
please me say how to put code in detail manner.



"JLatham" wrote:

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