Changing direction of cursor after hitting enter - toggling with toolbar macro??

S

StargateFan

After all these years of using Excel, decided that I finally need a
solution to this bit of annoyance <g>, although most of the time after
hitting Enter, I need the cursor to move to the right (esp. when
entering text), I find that too many times, I come across jobs where I
need the cursor to move down after hitting Enter. Anyone who really
works with inputting data in Excel, knows exactly what I mean.

I've done the manual workaround each time to get around this, I'll
manually change the movement via the Options.

Was hoping for a button that acts like a toggle. When raised, the
movement goes to the right; when depressed, the movement will be down.

I can picture the icon to draw, too.

But is there VB coding to do the actual changing? or perhaps there is
an option in the commands for a toolbar option that already exists to
do this (?).

Thanks. Any help appreciated.
 
J

JE McGimpsey

One way:

Public Sub ToggleEnterDirection()
With Application
If .MoveAfterReturnDirection = xlToRight Then
.MoveAfterReturnDirection = xlDown
Else
.MoveAfterReturnDirection = xlToRight
End If
End With
End Sub
 
D

Dave Peterson

Maybe something like:

Option Explicit
Sub testme()

Dim iCtr As Long
Dim myDirections As Variant
Dim myStrings As Variant

myDirections = Array(xlDown, xlUp, xlToLeft, xlToRight, xlDown)
myStrings = Array("Down", "Up", "Left", "Right", "Down")

For iCtr = LBound(myDirections) To UBound(myDirections)
If Application.MoveAfterReturnDirection = myDirections(iCtr) Then
Application.MoveAfterReturnDirection = myDirections(iCtr + 1)
MsgBox "changed to: " & myStrings(iCtr + 1)
Exit For
End If
Next iCtr

End Sub
 
S

StargateFan

One way:

Public Sub ToggleEnterDirection()
With Application
If .MoveAfterReturnDirection = xlToRight Then
.MoveAfterReturnDirection = xlDown
Else
.MoveAfterReturnDirection = xlToRight
End If
End With
End Sub

Just saw your message, sorry for delay in responding. It came in late
(ah, servers <g>!).

I'll try this, thank you!
 
S

StargateFan

One way:

Public Sub ToggleEnterDirection()
With Application
If .MoveAfterReturnDirection = xlToRight Then
.MoveAfterReturnDirection = xlDown
Else
.MoveAfterReturnDirection = xlToRight
End If
End With
End Sub

EXCELLENT! Finally got around to creating icon and assigning macro
(working on 2 or 3 other Excel projects). But this is going to be a
big help as I'm using Excel heavily now and sometimes data entry goes
down and sometimes one enters data along rows.

Thanks so much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top