tahsinanarat
Altın Üye
- Katılım
- 14 Mart 2005
- Mesajlar
- 2,181
- Excel Vers. ve Dili
- Ofis 2019 Türkçe
Aşağıdaki kod ile ekli dosyada icmal alabiliyorum, benim yapmak istediğim F sütununda KL ise E sütunundaki miktarın gelmesi eğer PK ise E sütunundaki miktarın ikiye bölünerek aktarılmasını istiyorum. örn. ilk satırda 1232 PK olduğu için ikiye bölündüğünde 616 olarak toplayıp aktarmasını istiyorum. Yardımca olabilecek arkadaşlara şimdiden teşekkür ederim.
Kod:
Sub AktarTopla()
Dim a, i As Long, b(), n As Long
Set s1 = Sheets("Sayfa1")
Set S2 = Sheets("İcmal")
veri = Array(1, 2)
Application.ScreenUpdating = False
S2.Range("A2:AB65536") = ""
'Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
With s1.Range("a2").CurrentRegion.Resize(, 25)
a = .Value
ReDim b(1 To UBound(a, 1), 1 To 25)
End With
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
For i = 1 To UBound(a, 1)
If Not .exists(a(i, 1)) Then
n = n + 1
.Add a(i, 1), n
For Each s In veri
b(n, s) = a(i, s)
Next
End If
b(.Item(a(i, 1)), 3) = b(.Item(a(i, 1)), 3) + a(i, 5)
b(.Item(a(i, 1)), 4) = b(.Item(a(i, 1)), 4) + a(i, 22)
b(.Item(a(i, 1)), 5) = b(.Item(a(i, 1)), 5) + a(i, 23)
b(.Item(a(i, 1)), 6) = b(.Item(a(i, 1)), 6) + a(i, 24)
b(.Item(a(i, 1)), 7) = b(.Item(a(i, 1)), 7) + a(i, 25)
b(.Item(a(i, 1)), 8) = b(.Item(a(i, 1)), 8) + a(i, 24) + a(i, 25)
Next
End With
With S2.Range("a1")
.CurrentRegion.Resize(, 3).ClearContents
.Resize(n, 25).Value = b
End With
Application.ScreenUpdating = True
S2.Select
sil
[A2:Z65536].Sort Key1:=[A2]
alttoplam
'MsgBox "Bitti"
Set s1 = Nothing
Set S2 = Nothing
End Sub
