Gruplama

Katılım
22 Mart 2005
Mesajlar
307
Merhaba;

Aşağıdaki kodlar ile A sütununa yazdığım verilere göre gruplama yapabiliyorum.
Bunu c sütununa yazdığım verilere göre nasıl düzeltebilirim?

Sub Ayir()
Range("A2:D58").Select
Selection.Sort Key1:=Range("a2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("B2").Select


Dim i, k As Integer
k = 0
For i = 2 To 50
If Cells(i, 1) = Cells(i + 1, 1) Then
k = k + 1
If k = 8 Then
Rows(i + 1).EntireRow.Insert
k = 0
i = i + 1
End If
Else
Rows(i + 1).EntireRow.Insert
k = 0
i = i + 1
End If
Next i
End Sub
 
Katılım
3 Mart 2005
Mesajlar
120
nasıl bir düzeltme yapacağınızı örnek bir dosya ile gönderirseniz ustalar daha kolay yardımcı olurlar sanırım..
 
Katılım
3 Mart 2005
Mesajlar
120
eğer anladığım doğruysa yerler değişince kodların nasıl değişeceğini soruyosunuz..

Sub Ayir()
Range("A2:D58").Select
Selection.Sort Key1:=Range("b2"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A2").Select


Dim i, k As Integer
k = 0
For i = 2 To 50
If Cells(i, 2) = Cells(i + 1, 2) Then
k = k + 1
If k = 8 Then
Rows(i + 1).EntireRow.Insert
k = 0
i = i + 1
End If
Else
Rows(i + 1).EntireRow.Insert
k = 0
i = i + 1
End If
Next i
End Sub

cevap bu olabilir mi acep?
 
Üst