IF function with cursor move

frogcon

New Member
Joined
Sep 18, 2019
Messages
11
I am using a hand scanner to scan the word "OK" or "NOT OK" into the D column of a table. There are 2 more columns in this table to be used only if the D column is not ok.

If I scan "OK" I want the cursor to move to the next row column A.

So, if everything is "OK" I want the cursor to start over at the next open row in column A.

this spreadsheet is to only by filled in by scanning. I don't want any interaction from the operators, so I am trying to make this automatic.

I am a novice to coding. I have tried so many different things and none have worked. That is why I a not posting any code for this question.

Please HELP!!!:eek: I am so confused.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Welcome to the forum!

Put the following macro in sheet events

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
  If Not Intersect(Target, Range("D:D")) Is Nothing Then
    If UCase(Target.Value) = "OK" Then
      Range("A" & Target.Row + 1).Select
    End If
  End If
End Sub

SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.
 
Upvote 0
Welcome to the forum!

Put the following macro in sheet events

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
  If Not Intersect(Target, Range("D:D")) Is Nothing Then
    If UCase(Target.Value) = "OK" Then
      Range("A" & Target.Row + 1).Select
    End If
  End If
End Sub

SHEET EVENT
Right click the tab of the sheet you want this to work, select view code and paste the code into the window that opens up.

That worked!! Thank you so much!!
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0
Dante, this worked like a charm... for that function! But now I have 2 Private Sub Worksheet_Change functions and one has stopped working.

The one you gave me and one for an auto time & date stamp:

If Target.Cell.Count >1 Then Exit Sub
If Not Intersect(Target, range("C3:C8931")) Is Nothing Then With Target (1, 6)
.Value = Date & " " & Time
.EntireColumn.AutoFit
End With
End If
End Sub


I don't know how to add the two together. Can you help?
 
Upvote 0
Try this

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Count > 1 Then Exit Sub
[COLOR=#008000]  'select next row[/COLOR]
  If Not Intersect(Target, Range("D:D")) Is Nothing Then
    If UCase(Target.Value) = "OK" Then
      Range("A" & Target.Row + 1).Select
    End If
  End If
[COLOR=#008000]  'auto time & date stamp[/COLOR]
  If Not Intersect(Target, Range("C3:C8931")) Is Nothing Then
    With Target(1, "F")
      .Value = Date & " " & Time
      .EntireColumn.AutoFit
    End With
  End If
End Sub
 
Upvote 0
Dante, I so appreciate you helping me!! Now, neither of the codes do what is expected.

Run this macro:

Code:
Sub en()
Application.EnableEvents = True
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,114,002
Members
448,543
Latest member
MartinLarkin

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