Press Enter --> Cell to the right selected --> Press Enter again --> Cell down and to the left selected

dim4x4

Board Regular
Joined
May 8, 2002
Messages
108
Hello!

Is it possible to do the following with a VBA macro:

1. After adding text to a certain cell and pressing Enter, the cell to the right is selected, and the cursor is blinking for entering info in the selected cell
2. After I add text to that cell and press Enter, the cell down and to the left is selected, and the cursor is blinking for entering info in the selected cell
Repeat 1
Repeat 2
Repeat 1
....

Also is it possible to turn on and turn off this macro, because I need it to regularly fill two very long columns. All other time, I need a normal Enter behavior.

Thank you!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
18,232
Office Version
  1. 2013
Platform
  1. Windows
You said:
After adding text to a certain cell

We may be able to write you a script to do at least part of what you want. The cursor blinking is not something I can do.

But to help out on the one part we need specific details.

Like any time I enter text into any cell in column 1 do this can be done

But a certain cell is not specific.
 

EXCEL MAX

Well-known Member
Joined
Nov 11, 2020
Messages
508
Office Version
  1. 2016
Platform
  1. Windows
Hello Dim4x4,
I have look at your problem and try to find a solution.
This is what I found.
As first create button to turn on code whenever you want.
Run this code with created button...
When you finish adding, press "Esc" button to exit selection and press created button again.
VBA Code:
Option Explicit

Dim vTurnOn, vB As Boolean
Dim vR As String

Private Sub TurnOn_Click()
   
    If vTurnOn = False Then
       vTurnOn = True
    Else
       vTurnOn = False
    End If

End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
   
    If vTurnOn = True Then
        vR = Target.Address
        If vB = False Then
           Range(vR).Offset(0, 1).Select
            vR = ActiveCell.Address
            vB = True
        Else
            Range(vR).Offset(1, -1).Select
            vR = ActiveCell.Address
            vB = False
        End If
        Application.SendKeys "{F2}"
    End If
   
End Sub
 
Solution

dim4x4

Board Regular
Joined
May 8, 2002
Messages
108
Hello EXCEL MAX!

Thank you for the macro! It works exactly how I wanted it!
 
Last edited:

EXCEL MAX

Well-known Member
Joined
Nov 11, 2020
Messages
508
Office Version
  1. 2016
Platform
  1. Windows
I'm glad that you accept this as solution.;)
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,589
Messages
5,765,317
Members
425,272
Latest member
Umba

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top