есть лист1 с данными из них идет выборка по критериям в лист2 нужно совершить операции с ячейками ЛИСТА1 (суммировать их при соблюдении условия)
Sub FillReport()
Dim i As Integer
Dim currentAgr As String: currentAgr = ""
Dim counter As Long: counter = 3
With wd
For i = 2 To .UsedRange.Rows.Count + 1
If .Cells(i, 1).Value <> currentAgr Then
wr.Rows(wr.Range("END").Row & ":" & wr.Range("END").Row).Insert Shift:=xlDown
counter = counter + 1
wr.Rows(counter & ":" & counter).Hidden = False
currentAgr = .Cells(i, 1).Value
End If
If .Cells(i, 1).Value = "ФИО" Then
wr.Cells(counter, 1).Value = .Cells(i, 2).Value
wr.Cells(counter, 2).Value = .Cells(i,

.Value
wr.Cells(counter, 3).Value = .Cells(i, 6).Value
ElseIf .Cells(i, 9).Text = "паспорт" Then
wr.Cells(counter, 4).Value = .Cells(i, 6).Value
End If
Next
For i = 2 To .UsedRange.Rows.Count + 1
If .Cells(i, 1).Value <> currentAgr Then
wr.Rows(wr.Range("END").Row & ":" & wr.Range("END").Row).Insert Shift:=xlDown
counter = counter + 1
wr.Rows(counter & ":" & counter).Hidden = False
currentAgr = .Cells(i, 1).Value
End If
If .Cells(i, 1).Value = "кличка" Then
wr.Cells(counter, 1).Value = .Cells(i, 2).Value
wr.Cells(counter, 2).Value = .Cells(i,

.Value
wr.Cells(counter, 3).Value = .Cells(i, 6).Value
ElseIf .Cells(i, 9).Text = "ксива" Then
wr.Cells(counter, 4).Value = .Cells(i, 6) ' здесь надо суммировать с ".Cells(i, 7)
End If
Next
End With
wr.Columns("A:H").EntireColumn.AutoFit
End Sub