DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub ToplamAL()
Dim i As Long, _
j As Long, _
d As Variant
Columns("H:H").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("H1") = "TUTAR"
Columns("I:I").Delete Shift:=xlToLeft
d = Range("A2").Value
j = 2
For i = 2 To Cells(Rows.Count, "A").End(3).Row + 1
If Not Cells(i, "A") = d Then
Cells(j, "H") = "=SUM(D" & j & ":D" & i - 1 & ")"
If Not j = i - 1 Then
With Range("H" & j & ":H" & i - 1)
.HorizontalAlignment = xlRight
.VerticalAlignment = xlTop
.MergeCells = True
End With
End If
j = i
d = Cells(i, "a")
End If
Next i
End Sub
Merhaba,
Deneyip sonucu bildirin lütfen.
Kod:Sub ToplamAL() Dim i As Long, _ j As Long, _ d As Variant Columns("H:H").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("H1") = "TUTAR" Columns("I:I").Delete Shift:=xlToLeft d = Range("A2").Value j = 2 For i = 2 To Cells(Rows.Count, "A").End(3).Row + 1 If Not Cells(i, "A") = d Then Cells(j, "H") = "=SUM(D" & j & ":D" & i - 1 & ")" If Not j = i - 1 Then With Range("H" & j & ":H" & i - 1) .HorizontalAlignment = xlRight .VerticalAlignment = xlTop .MergeCells = True End With End If j = i d = Cells(i, "a") End If Next i End Sub
Sub ToplamAL()
Dim i As Long, _
j As Long, _
d As Variant
Columns("H:H").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("H1") = "TUTAR"
Columns("I:I").Delete Shift:=xlToLeft
d = Range("A2").Value
j = 2
For i = 2 To Cells(Rows.Count, "B").End(3).Row + 1
If Not Cells(i, "A") = d Then
Cells(j, "H") = "=SUM(D" & j & ":D" & i - 1 & ")"
Cells(j, "H").HorizontalAlignment = xlCenter
If Not j = i - 1 Then
With Range("H" & j & ":H" & i - 1)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.MergeCells = True
End With
End If
j = i
d = Cells(i, "a")
End If
Next i
End Sub
Merhaba.
Kodları revize ettim deneyiniz.
Kod:Sub ToplamAL() Dim i As Long, _ j As Long, _ d As Variant Columns("H:H").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("H1") = "TUTAR" Columns("I:I").Delete Shift:=xlToLeft d = Range("A2").Value j = 2 For i = 2 To Cells(Rows.Count, "B").End(3).Row + 1 If Not Cells(i, "A") = d Then Cells(j, "H") = "=SUM(D" & j & ":D" & i - 1 & ")" Cells(j, "H").HorizontalAlignment = xlCenter If Not j = i - 1 Then With Range("H" & j & ":H" & i - 1) .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .MergeCells = True End With End If j = i d = Cells(i, "a") End If Next i End Sub

Sub ToplamAL()
Dim i As Long, _
j As Long, _
d As Variant
Application.ScreenUpdating = False
Columns("H:H").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("H1") = "TUTAR"
Columns("I:I").Copy
Range("H1").PasteSpecial xlPasteFormats
Range("G1").Activate
Columns("I:I").Delete Shift:=xlToLeft
d = Range("A2").Value
j = 2
For i = 2 To Cells(Rows.Count, "B").End(3).Row + 1
If Not Cells(i, "A") = d Then
Cells(j, "H") = "=SUM(D" & j & ":D" & i - 1 & ")"
Cells(j, "H").HorizontalAlignment = xlCenter
If Not j = i - 1 Then
With Range("H" & j & ":H" & i - 1)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.MergeCells = True
End With
End If
j = i
d = Cells(i, "a")
End If
Next i
Application.ScreenUpdating = True
End Su
Deneyiniz.
B sütunundaki satır sayısına göre işlem yapılmaktadır.
Eğer tablonuzun altında B sütununda başka veriler varsa onları da dikkate alacağından farklı biçimlendirme sonucu ortaya çıkabilir.
Kod:Sub ToplamAL() Dim i As Long, _ j As Long, _ d As Variant Application.ScreenUpdating = False Columns("H:H").Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("H1") = "TUTAR" Columns("I:I").Copy Range("H1").PasteSpecial xlPasteFormats Range("G1").Activate Columns("I:I").Delete Shift:=xlToLeft d = Range("A2").Value j = 2 For i = 2 To Cells(Rows.Count, "B").End(3).Row + 1 If Not Cells(i, "A") = d Then Cells(j, "H") = "=SUM(D" & j & ":D" & i - 1 & ")" Cells(j, "H").HorizontalAlignment = xlCenter If Not j = i - 1 Then With Range("H" & j & ":H" & i - 1) .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .MergeCells = True End With End If j = i d = Cells(i, "a") End If Next i Application.ScreenUpdating = True End Su
Kodu çalıştırdığınızda, istediğiniz sonucu alamıyor musunuz?
Eğer istediğiniz sonucu alamıyorsanız orijinal dosyanızı ekleyin kontrol edelim.
Kodu çalıştırdığınızda, istediğiniz sonucu alamıyor musunuz?
Eğer istediğiniz sonucu alamıyorsanız orijinal dosyanızı ekleyin kontrol edelim.
Kodu çalıştırdığınızda, istediğiniz sonucu alamıyor musunuz?
Eğer istediğiniz sonucu alamıyorsanız orijinal dosyanızı ekleyin kontrol edelim.