How to Move mouse cursor to specific next cell/Column based on a cell Value

azad092

Board Regular
Joined
Dec 31, 2019
Messages
198
Office Version
  1. 2007
Platform
  1. Windows
Hi
good morning all members
I want that when I enter a specific word in a cell the mouse cursor should be move to next specific cell or column that i want
for example if I enter the word "Call Back" in cell G2 the mouse cursor should move to the B3 of next row similarly if i enter the word "Ok" in G2 then the mouse cursor should move to the O2
how it can possible please guide me
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You could try this Worksheet_Change code. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Or Target.Row = 1 Then Exit Sub
  If Target.Column = 7 Then
    Select Case LCase(Target.Value)
      Case "call back"
        Cells(Target.Row + 1, "B").Select
      Case "ok"
        Cells(Target.Row, "O").Select
    End Select
  End If
End Sub
 
Upvote 0
Private Sub Worksheet_Change(ByVal Target As Range) If Target.CountLarge > 1 Or Target.Row = 1 Then Exit Sub If Target.Column = 7 Then Select Case LCase(Target.Value) Case "call back" Cells(Target.Row + 1, "B").Select Case "ok" Cells(Target.Row, "O").Select End Select End If End Sub
Thanks for kind attention
But dear its not working
there are two conditions, i am sorry that I could not explain you.
condition one is that if I enter Call Back in Column U then the Mouse cursor should move the next row column D
condition two is that if I enter OK in Column G then the Mouse cursor should move the next column L within the same row
 
Upvote 0
its not working
That will most likely be because you have completely changed the conditions! ;)


if I enter the word "Call Back" in cell G2 the mouse cursor should move to the B3
if I enter Call Back in Column U then the Mouse cursor should move the next row column D


if i enter the word "Ok" in G2 then the mouse cursor should move to the O2
if I enter OK in Column G then the Mouse cursor should move the next column L


VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Or Target.Row = 1 Then Exit Sub
  If Target.Column = 21 And LCase(Target.Value) = "call back" Then Cells(Target.Row + 1, "D").Select
  If Target.Column = 7 And LCase(Target.Value) = "ok" Then Cells(Target.Row, "L").Select
End Sub
 
Upvote 0
That will most likely be because you have completely changed the conditions! ;)








VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.CountLarge > 1 Or Target.Row = 1 Then Exit Sub
  If Target.Column = 21 And LCase(Target.Value) = "call back" Then Cells(Target.Row + 1, "D").Select
  If Target.Column = 7 And LCase(Target.Value) = "ok" Then Cells(Target.Row, "L").Select
End Sub
Hi peter
good morning
thanks for reply
I apply your suggested code but still its not working
if you have applied this code please share the file thanks again
 
Upvote 0
I apply your suggested code but still its not working
If suggested code does not do what you want, you need to be specific about in what way it failed otherwise helpers have no idea what the issue is.
- Did Excel crash?
- Did the code give an error message?
- Did the cursor move to the wrong place?
- Did nothing happen?
- Did something else happen?

First thing for you to check is whether you installed the code in the correct place as per the instructions in post #2. You can check now by right-clicking the sheet tab of the sheet you want this code to act on and choose 'View Code'. The vba window should open with the code immediately visible.
 
Upvote 0
Dear Peter
after applying the code nothing happened
I have an idea
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheet1.Columns.Range("G2") = "OK" Then
Exit Sub
else
Call MoveNext
End If
End Sub
and the macro coding is as under

Sub MoveNext()
ActiveCell.Offset(0, 6).Select
End Sub
now what s the issue....issue is that when I run this macro in any area of any sheet its work fine but when I want run this macro as in above worksheet value change in specific column it does not work.... guide me if you understand it
thanks again for you attention
 
Upvote 0
Here is a link to my file. After you download & open it, type OK into any one of the yellow cells or Call back into any of the green cells.
If you right click the Sheet1 name tab and choose View Code you will see the code from post #4

 
Upvote 0
Here is a link to my file. After you download & open it, type OK into any one of the yellow cells or Call back into any of the green cells.
If you right click the Sheet1 name tab and choose View Code you will see the code from post #4

Hi peter
good morning and have a nice day
thanks a lot for great help.... its working fine.... a little help need more
if I want that when I type any word in G2 column except the word OK and then the coding should apply i.e
If G2 not equal to OK ....for this condition what the VBA operator I have to use please guide thanks
 
Upvote 0

Forum statistics

Threads
1,215,012
Messages
6,122,682
Members
449,091
Latest member
peppernaut

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