Forum Discussion

Sameer_Kuppanath_Sultan's avatar
Sameer_Kuppanath_Sultan
Brass Contributor
Dec 28, 2020
Solved

VBA to move to a specific cells after Pressing "Enter"

Hi All Happy Chrismas and New Year   Please, I have code below. It helps me to move to right cell after entering data either in "C" or "D".   But I need to modify this code that- to move the sel...
  • JMB17's avatar
    Dec 28, 2020

    Sameer_Kuppanath_Sultan 

     

    Private Sub Worksheet_Change(ByVal Target As Range)
    
         If Not Intersect(Target, Me.Range("c:d")) Is Nothing Then
              Target.Offset(0, 1).Activate
         ElseIf Not Intersect(Target, Me.Range("e:e")) Is Nothing Then
              Target.Offset(1, -2).Activate
         End If
    
    End Sub

     

    As a side note, if you hit the tab key after inputting into Columns C and D and then hit the enter key after inputting into Column E, that would also give you the desired effect. 

     

Resources