#1
|
|||
|
|||
macro to auto move cursor to start column
Hi I am trying to find a macro to auto move the curser after pressing enter for example.
After typing in data in cells a1 a2 a3 a4 a5 a6 when I hit enter on cell a6 the curser auto moves to cell b1 and again when getting to b6 and hit enter it moves to c1 and so forth can anyone please help. |
#2
|
||||
|
||||
There are several ways.
1. Select the cells A1:C6, start typing, press Enter, type some more, repeat. It will take you to the cells in the order you want providing you've kept Direction: Down for After pressing Enter, move selection at the top of the Editing Options of the Advanced section of Excel's Options (the default) 2. Select the cells A1:C6, go into Format cells and in the Protection tab, untick the Locked checkbox. Then protect the sheet, unticking the checkbox Select Locked Cells before you click OK. (The same applies about After pressing Enter, move selection in solution 1 above) If neither of these is good enough then come back. |
#3
|
|||
|
|||
Hi thank you very much for your quick reply I have to say a big sorry I have posted the question completely wrong
your answer is right but what is needed is data entered in a1,b1,c1,d1,e1,f1 then after the enter on f1 the curser moves to a2 then on reaching f2 press enter and auto move to a3 hope this makes sense. I did this with a macro a few years back but can't remember it sorry again and thanks. |
#4
|
||||
|
||||
Then try again after changing to Direction: Right for After pressing Enter in options.
|
#5
|
||||
|
||||
Using a macro, if you've only one area on a sheet where you want this to happen then a variation of this in the sheet's code-module:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo errhandler Set myRng = Range("A1:F6") '<<<set your area here. If Intersect(Target, myRng) Is Nothing Then Application.MoveAfterReturnDirection = xlDown Else Application.EnableEvents = False myRng.Select: Target.Activate Application.EnableEvents = True Application.MoveAfterReturnDirection = xlToRight End If errhandler: Application.EnableEvents = True End Sub Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) On Error GoTo errhandler Set myRng = Range("A1:F6,C10:F11") '<<<set your areas here. If Intersect(Target, myRng) Is Nothing Then Application.MoveAfterReturnDirection = xlDown Else For Each are In myRng.Areas If Not Intersect(are, Target) Is Nothing Then Set myRng = are Exit For End If Next are Application.EnableEvents = False myRng.Select: Target.Activate Application.EnableEvents = True Application.MoveAfterReturnDirection = xlToRight End If errhandler: Application.EnableEvents = True End Sub |
#6
|
|||
|
|||
Many thanks for your help but still can't get it working I am on a mac using 2019 version of excel does that matter ?. Also when searching google I got this
Sub jumpnext() Range("A" & ActiveCell.Row + 1).Select End Sub does it make any sense to you as I can't get this working either I know that a few years ago I got what I wanted with the above or something very similar but on a windows pc. anymore help would be much appreciated. |
#7
|
|||
|
|||
just to let you know it is a stamp collection work sheet I am trying to put together.
|
#8
|
||||
|
||||
It begins to look like it does. I know nothing if the Mac's version of Excel's idiosyncrasies!
This snippet, when run will move the selection from the currently active cell to column A of the row below. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro Needed to Move Info from Column A to Column B and C | rsrasc | Excel Programming | 5 | 04-01-2018 06:05 AM |
A macro to find a symbol, delete it, and move the cursor to that location | JayBird24 | Word VBA | 1 | 08-19-2016 04:26 PM |
move cursor | anand | Word VBA | 14 | 07-07-2015 05:57 AM |
How do I move the cursor back to the text from a comment without using the mouse? | MsT | Word | 2 | 04-24-2014 05:48 PM |
can't move the cursor in Word | pieboy | Word | 2 | 02-13-2009 07:15 PM |