skipping cells

khoover12

New Member
Joined
May 20, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I am working on an inventory log sheet; I need help with a code that when after entering value/text into cell A5(column A) that the cursor will move to cell C5(column C) and after a value/text is entered into C5 the cursor moves to cell E5(column E). Can anyone help me create this code or point me in the right direction?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Select Case Target.Column
        Case 1 'column a
            Cells(Target.Row, 3).Select 'move to Col c
        Case 3 ' COlumn C
            Cells(Target.Row, 5).Select ' move t
        Case 5 ' column E
            'Whatever you need to do when user has exited last column
        Case Else
    End Select
End Sub
 
Last edited:
Upvote 0
Hi to all.
I prefer this approach. The macro needs to be pasted in the sheet's module becaused it is triggered by event Worksheet_Change.
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Select Case Target.Address()
        Case "$A$5"
            Range("$C$5").Select
        Case "$C$5"
            Range("$E$5").Select
        Case "$E$5"
            Range("$A$5").Select
    End Select
End Sub
 
Upvote 0
Since you said you want this to happen after entering a value, I think you should use the Change event to do it. I assume your specifying cells A5 and C5 was for example purposes only and that you want this movement from column to column to occur for entries into any cell in Columns A or C.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge = 1 Then
    If Target.Column = 1 Or Target.Column = 3 Then Target.Offset(, 2).Select
  End If
End Sub
HOW TO INSTALL Event Code
------------------------------------
If you are new to event code procedures, they are easy to install. To install it, right-click the name tab at the bottom of the worksheet that is to have the functionality to be provided by the event code and select "View Code" from the popup menu that appears. This will open up the code window for that worksheet. Copy/Paste the event code into that code window. That's it... the code will now operate automatically when its particular event procedure is raised by an action you take on the worksheet itself. Note... if you are using XL2007 or above, make sure you save your file as an "Excel Macro-Enabled Workbook (*.xlsm) and answer the "do you want to enable macros" question as "yes" or "OK" (depending on the button label for your version of Excel) the next time you open your workbook.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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