Forum Discussion
Sameer_Kuppanath_Sultan
Dec 28, 2020Brass Contributor
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...
- Dec 28, 2020
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.
JMB17
Dec 28, 2020Bronze Contributor
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.
- Sameer_Kuppanath_SultanDec 29, 2020Brass Contributor
DoneJMB17