Hello,
sorry for my poor english....
I have the following problem
When I fill in a value in the field in column D (the next row with 24), I automatically want column A to increase my position from the row above.It works when I use the Enter key, but if after completing field D I try to go to the next field with Tab or Arrows, the confirmation is no longer done.Thank you
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "D").End(xlUp).Row - 1
Dim ans As String
Dim r As Long
Dim rr As Long
Dim searchTerm As Range
ans = Target.Value
r = Target.Row
Set searchTerm = Range("D24:D" & Lastrow).Find(what:=ans, searchorder:=xlByColumns, searchdirection:=xlPrevious)
If searchTerm Is Nothing Then Exit Sub
rr = searchTerm.Row + 1
Cells(rr + 1, 1).Value = rr + 1 - 23 'incrementam randul cu 1 unitate si scadem randul 23 / numerotarea incepe de la randul 24 care e in tabel pozitia 1
End If
End Sub
sorry for my poor english....
I have the following problem
When I fill in a value in the field in column D (the next row with 24), I automatically want column A to increase my position from the row above.It works when I use the Enter key, but if after completing field D I try to go to the next field with Tab or Arrows, the confirmation is no longer done.Thank you
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Then
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "D").End(xlUp).Row - 1
Dim ans As String
Dim r As Long
Dim rr As Long
Dim searchTerm As Range
ans = Target.Value
r = Target.Row
Set searchTerm = Range("D24:D" & Lastrow).Find(what:=ans, searchorder:=xlByColumns, searchdirection:=xlPrevious)
If searchTerm Is Nothing Then Exit Sub
rr = searchTerm.Row + 1
Cells(rr + 1, 1).Value = rr + 1 - 23 'incrementam randul cu 1 unitate si scadem randul 23 / numerotarea incepe de la randul 24 care e in tabel pozitia 1
End If
End Sub