這裡我少算了一格
With [採購需求表!A2].Resize(N, 4)
.Parent.[D1] = DD
.Value = Brr
.Sort Key1:=.Item(1), Order1:=xlAscending, _
Key2:=.Item(2), Order2:=xlAscending, Header:=xlNo
For i = N + 1 To 3 Step -1 '3 應改為 2
If .Cells(i, 1) <> .Cells(i - 1, 1) Then
.Cells(i, 1).Resize(1, 4).Insert Shift:=xlDown
End If
Next i
End With