DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
arkadaşlar ekli dosyanın içinde herşeyi anlattım.
Yardımcı olursanız çok sevinirim
Sub SartliRapor()
Dim d As Object, i As Long, sat As Long, n As Byte, deg, a1, a2, s
Set d = CreateObject("Scripting.Dictionary")
Application.ScreenUpdating = False
Range("C3:E" & Rows.Count).ClearContents
Range("C2") = "Döküm No": Range("D2") = "Adet": Range("E2") = "B.Adet"
For i = 3 To Cells(Rows.Count, "B").End(xlUp).Row
deg = Cells(i, "B")
n = 0
If Not d.exists(deg) Then
If Cells(i, "A").Interior.ColorIndex = 6 Then n = 1
s = Array(1, n)
d.Add deg, s
Else
s = d.Item(deg)
s(0) = s(0) + 1
If Cells(i, "A").Interior.ColorIndex = 6 Then s(1) = s(1) + 1
d.Item(deg) = s
End If
Next i
a1 = d.keys: a2 = d.items: sat = 3
For i = 0 To d.Count - 1
Cells(i + sat, "C") = a1(i)
s = a2(i)
Cells(i + sat, "D") = s(0)
Cells(i + sat, "E") = s(1)
Next i
Application.ScreenUpdating = True
End Sub
dün yaptığımızkodların yanında bu extrası.
Mesela alınan testin ardından 50 boru geçtiyse alınması gereken numara kırmızı olabilir.
Birde 25-50-100 bu periyodu belirleyeceğim bir yer olursa süper olur
Sub SartliRapor()
Dim d As Object, i As Long, sat As Long, n As Byte, say As Long, deg, a1, a2, s, sor
Set d = CreateObject("Scripting.Dictionary")
On Error Resume Next
sor = Application.InputBox("Periyod Sayısı Girin", "Dikkat!")
If sor = "" Or sor = 0 Then Exit Sub
Application.ScreenUpdating = False
Range("C3:E" & Rows.Count).ClearContents
Range("C2") = "Döküm No": Range("D2") = "Adet": Range("E2") = "B.Adet"
For i = 3 To Cells(Rows.Count, "B").End(xlUp).Row
say = say + 1
deg = Cells(i, "B")
n = 0
If Not d.exists(deg) Then
If Cells(i, "A").Interior.ColorIndex = 6 Then n = 1
s = Array(1, n)
d.Add deg, s
Else
s = d.Item(deg)
s(0) = s(0) + 1
If Cells(i, "A").Interior.ColorIndex = 6 Then s(1) = s(1) + 1
d.Item(deg) = s
End If
If say Mod sor = 1 And say <> 1 Then Cells(i, "A").Interior.ColorIndex = 3: say = 0
If Cells(i, "A").Interior.ColorIndex = 6 Then say = 0
Next i
a1 = d.keys: a2 = d.items: sat = 3
For i = 0 To d.Count - 1
Cells(i + sat, "C") = a1(i)
s = a2(i)
Cells(i + sat, "D") = s(0)
Cells(i + sat, "E") = s(1)
Next i
Application.ScreenUpdating = True
End Sub