MichaelA-5718 avatar image
0 Votes"
MichaelA-5718 asked

copy and paste between worksheets not working, if attached excel code is active!

If I use the following code in Excel, I cannot copy and paste between worksheets, if the code is deleted everything seems in order:

 ' moving the cursor to the right rather than down
 Private Sub Worksheet_Activate()
   Application.MoveAfterReturnDirection = xlToRight
 End Sub
 ' move the cursor down
 Private Sub Worksheet_Deactivate()
     Application.MoveAfterReturnDirection = xlDown
 End Sub

If I use the ENTER key, the default behaviour is: move the cursor down.
Above code should change this behaviour to moving the cursor to the right, just for one worksheet.
Note: I can copy and paste on the same worksheet, but not between the worksheet, associated with this code and any other worksheet.
copy and paste still would work between any other worksheets.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers