Private Sub Worksheet_Change(ByVal Target As Range)
Dim parca As String, i As Long, kacinci As Integer
Dim arr, say As Long, secilenRow As Long
Const AktarmaSutun As String = "M"
If Target.Row < 2 Then Exit Sub
If Target.Column <> 11 Then Exit Sub
If Target.Rows.Count = 1 Then
kacinci = InStrRev(Target.Value, " ")
secilenRow = Target.Row
If kacinci > 0 Then
parca = Mid(Target.Value, kacinci + 1)
Cells(Target.Row, AktarmaSutun).Value = IIf(parca = "", "", parca)
Else
Cells(Target.Row, AktarmaSutun).Value = ""
End If
ElseIf Target.Rows.Count > 1 Then
secilenRow = Selection.Row
ReDim arr(1 To (Selection.Cells.Count - 1) + Selection.Row, 1 To 1)
For i = Selection.Row To (Selection.Cells.Count - 1) + Selection.Row
kacinci = InStrRev(Cells(i, Target.Column).Value, " ")
If kacinci > 0 Then
say = say + 1
parca = Mid(Cells(i, Target.Column).Value, kacinci + 1)
arr(say, 1) = IIf(parca = "", "", parca)
Else
say = say + 1: arr(say, 1) = ""
End If
Next
End If
If say > 0 Then Cells(secilenRow, AktarmaSutun).Resize(say, 1).Value = arr
On Error Resume Next
Erase arr
End Sub
Buda hızlı veriyon