Sayın Orion1'in örneklerinden faydalanarak aşağıdaki kodu kendime göre uyarladım. Kod gayet güzel çalışıyor. Verileri sayfaya değilde listview'e aktara bilirmiyiz.
Kod:
Private Sub CommandButton1_Click()
Dim list(), i, z, iade
Set s1 = Sheets("Hareket")
Set s2 = Sheets("Scripting_Dictionary")
Application.ScreenUpdating = False
Set z = CreateObject("Scripting.dictionary")
list = s1.Range("B2:H" & s1.Cells(Rows.Count, "B").End(xlUp).Row).Value
For i = 1 To UBound(list)
If list(i, 1) = "Satış_Çıkış" Then
iade = -1
Else
iade = 1
End If
If list(i, 1) = "Satış_Çıkış" Then
If Not z.exists(list(i, 6)) Then
z.Add list(i, 6), list(i, 7) * iade
Else
z.Item(list(i, 6)) = z.Item(list(i, 6)) + (list(i, 7) * iade)
End If
ElseIf list(i, 1) = "Giriş_Alış" Then
If Not z.exists(list(i, 6)) Then
z.Add list(i, 6), list(i, 7) * iade
Else
z.Item(list(i, 6)) = z.Item(list(i, 6)) + (list(i, 7) * iade)
End If
End If
Next i
If z.Count > 0 Then
sat = s2.[a65536].End(3).Row + 1
s2.Range(s2.Cells(2, "a"), s2.Cells(sat, "d")).ClearContents
s2.[a2].Resize(z.Count, 2) = Application.Transpose(Array(z.keys, z.items))
Application.ScreenUpdating = True
End If
Set s1 = Nothing
Set s2 = Nothing
End Sub
