Excel 2010 - Enter text into cell, meet 1 of 4 possible conditions, and upon TAB or ENTER, skip to another column in same row automatically.

Rognab

New Member
Joined
Feb 23, 2022
Messages
4
Office Version
  1. 2010
Platform
  1. Windows
Excel 2010 - Enter text into cell, meet 1 of 4 possible conditions, and upon TAB or ENTER, skip to another column in same row automatically.

Example:
Enter data "abc" into cell C28, and upon TAB or ENTER send cursor automatically to G28.
OR if "def" had been entered, then jump to H28. Etc.
There are 4 dropdown values in C28 to select from.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try right clicking the sheet tab, selecting View Code and pasting this into the sheet module
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Address = "$C$28" Then
        Select Case Target.Value
            Case "abc"
                Cells(Target.Row, "G").Select
            Case "def"
                Cells(Target.Row, "H").Select
            Case "ghi"
                Cells(Target.Row, "I").Select
            Case "jkl"
                Cells(Target.Row, "J").Select
        End Select
    End If

End Sub
 
Upvote 0
Private Sub Worksheet_Change(ByVal Target As Range) If Target.CountLarge > 1 Then Exit Sub If Target.Address = "$C$28" Then Select Case Target.Value Case "abc" Cells(Target.Row, "G").Select Case "def" Cells(Target.Row, "H").Select Case "ghi" Cells(Target.Row, "I").Select Case "jkl" Cells(Target.Row, "J").Select End Select End If End Sub
This worked perfectly.

I noticed that the range was specified at the beginning.
Do I need to redifine the the range to be sure all rows are included or just pull the handles down?
This code needs to apply to every row.

And you have my most appreciative thanks.
 
Upvote 0
I hope the comments in this code explains use of this event macro, you only need one of the three
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.CountLarge > 1 Then Exit Sub
    
    ' for single cell use like
    'If Target.Column = "C$28" Then
    
    ' for entire column use like
    'If Target.Column = 3 Then
    
    ' for a specific range use like
    If Not Intersect(Target, Range("C10:C30")) Is Nothing Then
    
        Select Case Target.Value
            Case "abc"
                Cells(Target.Row, "G").Select
            Case "def"
                Cells(Target.Row, "H").Select
            Case "ghi"
                Cells(Target.Row, "I").Select
            Case "jkl"
                Cells(Target.Row, "J").Select
        End Select
    End If

End Sub
Hope that helps
 
Upvote 0
Solution
I hope the comments in this code explains use of this event macro, you only need one of the three
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   
    If Target.CountLarge > 1 Then Exit Sub
   
    ' for single cell use like
    'If Target.Column = "C$28" Then
   
    ' for entire column use like
    'If Target.Column = 3 Then
   
    ' for a specific range use like
    If Not Intersect(Target, Range("C10:C30")) Is Nothing Then
   
        Select Case Target.Value
            Case "abc"
                Cells(Target.Row, "G").Select
            Case "def"
                Cells(Target.Row, "H").Select
            Case "ghi"
                Cells(Target.Row, "I").Select
            Case "jkl"
                Cells(Target.Row, "J").Select
        End Select
    End If

End Sub
Hope that helps
Yes, All is working well. Your solution was spot on.
I am most appreciative.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,213
Members
452,618
Latest member
Tam84

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