Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [d1]) Is Nothing Then
Dim lRow As Long, Zw As Long, SDg As Long
Dim Cuoi, Rng As Range
SDg = [a65432].End(xlUp).Row - 1
If SDg = 0 Then Exit Sub
With Sheets("DL")
lRow = .[b65432].End(xlUp).Row
Cuoi = .Range("A" & .[a65432].End(xlUp).Row).Value
If Cuoi = Target Then
Range("A2:A" & SDg).Copy Destination:=.Cells(lRow + 1, 2)
Exit Sub
Else
1 Set Rng = .Columns("A:A").Find(Target + 1, LookIn:=xlValues)
If Rng Is Nothing Then
3 Exit Sub
Else
5 Rng.Resize(SDg, 1).EntireRow.Insert
Range("A2:A" & SDg + 1).Copy Destination:=Rng.Offset(-SDg, 1)
7 End If
End If
' For Zw = 2 To lRow'
' If .Cells(Zw, 1) = Target + 1 Then'
' .Cells(Zw, 1).Resize(SDg , 1).EntireRow.Insert'
' Range("A2:A" & SDg).Copy Destination:=.Cells(Zw, 2)'
' Exit For'
' End If'
' Next Zw'
End With
End If
End Sub