Move Cursor to Next Cell Based on Data Entry Only

  • Hi Excel Expert Friends


    I need a small help from you


    Here what I want I am doing data entry From Col-A to Col-D here I want changes in this vba code here if type any value from col-A to col-D then only cursor will move to next cell


    Like if i enter any value on Col-A and Press Enter then move cursor to next cell of Col-B like this for every column from A to D


    If I don’t enter any value on Col-A and Press Enter then a pop-up MsgBox will be show me a message like this


    MsgBox(You Can’t Leave Cell Blank Please Enter any Value to Move to Next Cell)


    Like this I want for every Column From A to D





    Code
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
        If Target.Column = 1 Then Range("B" & Target.Row).Select
        If Target.Column = 2 Then Range("C" & Target.Row).Select
        If Target.Column = 3 Then Range("D" & Target.Row).Select
        If Target.Column = 4 Then Range("A" & Target.Row + 1).Select
    End Sub
    • Best Answer

    Your code seems to cover everything except the message. Also you have four mutually exclusive conditions so should not use serial If statements.


    Jeff


    Making the world a better place one fret at a time | | |·| |·| |·| |·| | |:| | |·| |·|

  • PrasadK

    Selected a post as the best answer.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!