Sub 按供应商_合同编号_拆分_多条记录()
Dim ws As Worksheet
Dim newWb As Workbook
Dim lastRow As Long
Dim i As Long
Dim savePath As String
Dim dict As Object
Dim key As Variant
Dim 合同编号 As String, 供应商名称 As String
' ↓↓↓ 关键修复:循环复制所有匹配行 ↓↓↓
For i = 4 To lastRow
If Trim(ws.Cells(i, "G").Value) = 合同编号 _
And Trim(ws.Cells(i, "L").Value) = 供应商名称 Then
' 粘贴到下一行
ws.Rows(i).Copy _
newWb.Sheets(1).Cells(newWb.Sheets(1).Rows.Count, "A").End(xlUp).Offset(1, 0)
End If
Next i