Dim lRow As Long, No As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
lRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Set No = Range("A" & Target.Row)
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A:H")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Dim lRow2 As Long, fnd As Range, header As Range, desWS As Worksheet
lRow2 = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Set desWS = Sheets("Ücret Verisi")
If lRow = lRow2 Then
Select Case Target.Column
Case 2 To 8
Set fnd = desWS.Range("A:A").Find(No, LookIn:=xlValues, lookat:=xlWhole)
If Not fnd Is Nothing Then
Set header = desWS.Rows(1).Find(Cells(2, Target.Column), LookIn:=xlValues, lookat:=xlWhole)
desWS.Cells(fnd.Row, header.Column) = Target
End If
Case Is = 1
If Target.Row > lRow2 Then
desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1) = Target
Else
Set fnd = desWS.Range("A:A").Find(No.Offset(-1), LookIn:=xlValues, lookat:=xlWhole)
If Not fnd Is Nothing Then
desWS.Range("A" & fnd.Row + 1) = Target
End If
End If
End Select
Else
If Range("A" & Target.Row) = "" Then
Set fnd = desWS.Range("A:A").Find(No, LookIn:=xlValues, lookat:=xlWhole)
If Not fnd Is Nothing Then
desWS.Range("A" & fnd.Row).EntireRow.Insert
End If
Else
Set fnd = desWS.Range("A:A").Find(Range("A" & Target.Row), LookIn:=xlValues, lookat:=xlWhole)
If Not fnd Is Nothing Then
desWS.Rows(fnd.Row - 1).Delete
End If
End If
End If
Application.ScreenUpdating = True
End Sub