+ Reply to Thread
Results 1 to 4 of 4

How automatically move cursor from one cell to another based on condition

  1. #1
    Registered User
    Join Date
    03-06-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    95

    How automatically move cursor from one cell to another based on condition

    Dear Team

    I have an excel file for data entry with fixed 8 rows and 12 columns (D8:O15), the data entry operator will enter the data from D8 to D15 after entering the value in D15 the cursor has to go to E8. After entering the values from E8 to E15 the cursor has to go to F8 like this till O15 they need to enter the data after that they will take the printout and clear the values for next entry.

    can you please help me to work on this

    I tried with below code for that is working only for one column D8 to D15.

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Updated by Extendoffice 2020087
    Dim tabArray As Variant
    Dim i As Long
    tabArray = Array("D15", "E8")
    Application.ScreenUpdating = False
    For i = LBound(tabArray) To UBound(tabArray)
    If tabArray(i) = Target.Address(0, 0) Then
    If i = UBound(tabArray) Then
    Me.Range(tabArray(LBound(tabArray))).Select
    Else
    Me.Range(tabArray(i + 1)).Select
    End If
    End If
    Next i
    Application.ScreenUpdating = True
    End Sub



    Thanks in advance
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: How automatically move cursor from one cell to another based on condition

    try

    Please Login or Register  to view this content.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: How automatically move cursor from one cell to another based on condition

    Something like this:
    PHP Code: 
    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.ScreenUpdating False
    Dim r
    &
    If 
    Intersect(TargetRange("D8:O15")) Is Nothing Then Exit Sub
        
    If Target.Row 15 Then Target.Offset(-71).Select' assume last row is row 15
    Application.ScreenUpdating = True
    End Sub 
    Quang PT

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Re: How automatically move cursor from one cell to another based on condition


    ScreenUpdating codelines are useless like the Dim codeline as well …

    If the tab key is used to valid an entry or even a mouse click on any cell :

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
        
    With Target
            
    If .CountLarge 1 Then If Not Intersect([D8:O15], .CellsIs Nothing Then If .Row 15 Then .Cells(2).Select Else .Cells(-62).Select
        End With
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 03-17-2022 at 08:41 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automatically move cursor to next unprotected cell
    By thedunna in forum Excel General
    Replies: 15
    Last Post: 05-27-2020, 12:29 AM
  2. Replies: 1
    Last Post: 09-06-2018, 09:39 PM
  3. Replies: 1
    Last Post: 03-28-2017, 06:38 PM
  4. Move Cell cursor to second workbook based on lookup
    By philwilliams80 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2011, 06:09 AM
  5. Replies: 1
    Last Post: 07-26-2010, 03:30 PM
  6. Having the cursor automatically move to the cell to the right
    By bobbby1949 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-23-2010, 08:04 PM
  7. Replies: 1
    Last Post: 08-26-2005, 03:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1