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

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
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.
 
Upvote 0
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
 
Upvote 0
Solution
Hello EXCEL MAX!

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

Forum statistics

Threads
1,215,020
Messages
6,122,712
Members
449,093
Latest member
Mnur

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
Back
Top