Sıfır değerleri

Katılım
2 Mart 2006
Mesajlar
103
Excel Vers. ve Dili
Office 2003 Türkçe
Herkese Merhaba.
Sub topla()
For x = 2 To [a65536].End(3).Row
Cells(x, 7) = WorksheetFunction.Sum(Cells(x, 2), Cells(x, 3), Cells(x, 4), Cells(x, 5), Cells(x, 6))
Next x
End Sub
1- Yukarıdaki kod ile A sütunundaki boş olmayan hücrelerin satır toplamını g sütununa aldırıyorum. Fakat A sütununda arada boş satır olduğu zaman g sütununa 0 "sıfır" yazıyor. A sütunu boşsa "0" yazmamasının kodlu çözümü nedir acaba.
2- Cells(x, 7) = WorksheetFunction.Sum(Cells(x, 2), Cells(x, 3), Cells(x, 4), Cells(x, 5), Cells(x, 6)) kodu kısaltılabilir mi .
İlgilniz için şimdiden teşekkürler.
 

veyselemre

Özel Üye
Katılım
9 Mart 2005
Mesajlar
3,614
Excel Vers. ve Dili
Pro Plus 2021
Kod:
For x = 2 To [a65536].End(3).Row
    Top = WorksheetFunction.Sum(Range(Cells(x, 2), Cells(x, 6)))
    If Top > 0 Then Cells(x, 7) = Top
Next x
 

Kemal Demir

Özel Üye
Katılım
29 Temmuz 2004
Mesajlar
2,108
2.Sorunuza Aşagıdaki gibi çozum sağlaya biliriz.

Kod:
Sub topla()
For x = 2 To [b65536].End(3).Row
For c = 2 To 6
[u][b]'c kolon aralıklarını belirler[/b][/u]
Cells(x, 7).Value = Cells(x, 7).Value * 1 + WorksheetFunction.Sum(Cells(x, c))
Next
Next
End Sub
 
Son düzenleme:
Katılım
2 Mart 2006
Mesajlar
103
Excel Vers. ve Dili
Office 2003 Türkçe
Sayın Veyselemre Bey ve Sayın Rakkas çok teşekkür ederim. Elinize sağlık.
 
Üst