Go to a specific cell after entering data in another cell and click "Input Options"

I have an Excel worksheet and I enter data in A2, B2 and C2; after I press, enter the cursor, select the next line so that I can enter information on A3, B3 and C3, etc.

I found this information

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("C2").Value <> "" Then
Range("A3").Select
End If
End Sub

But it only works once, how can I repeat this process over and over again

Thank you for your help.....

+5
source share
3 answers

Another way.

  • If you type somewhere in Col A, the selection moves to Col B.
  • If you type somewhere in Col B, the selection moves to Col C.
  • If you type somewhere in Col C, the selection returns to Col A (Next line).

Code . This refers to the corresponding area of ​​the sheet code.

Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo Whoa

    Application.EnableEvents = False

    If Not Target.Cells.CountLarge > 1 Then
        If Not Intersect(Target, Columns(1)) Is Nothing Then
            Target.Offset(, 1).Select
        ElseIf Not Intersect(Target, Columns(2)) Is Nothing Then
            Target.Offset(, 1).Select
        ElseIf Not Intersect(Target, Columns(3)) Is Nothing Then
            Target.Offset(1, -2).Select
        End If
    End If
Letscontinue:
    Application.EnableEvents = True
    Exit Sub
Whoa:
    MsgBox Err.Description
    Resume Letscontinue
End Sub

ScreenShot

enter image description here

+6

"" > "" Enter?:

enter image description here

Tech Republic: Excel , , , ...

, , , Excel , {Tab}. Excel

Voila!

+1

VBA , , :

Application.MoveAfterReturnDirection = xlToRight 
Application.MoveAfterReturn = True
+1
source

All Articles