değişkene göre toplama işlemi

Katılım
11 Ağustos 2006
Mesajlar
87
Excel Vers. ve Dili
2000 türkçe
arkadaşlar merhaba

Kod:
Private Sub ComboBox2_Change()
ListBox1.Clear
For X = 2 To [A65536].End(3).Row
    If Left(Cells(X, 2), 50) = ComboBox2.Value And Left(Cells(X, 1), 50) = ComboBox1.Value Then
    c = c + 1
    ListBox1.AddItem
    ListBox1.List(c - 1, 0) = Sheets("SAYFA1").Cells(X, 1)
    ListBox1.List(c - 1, 1) = Sheets("SAYFA1").Cells(X, 2)
    ListBox1.List(c - 1, 2) = Sheets("SAYFA1").Cells(X, 28)
    End If
Next
End Sub
bu formulde Cells(X, 28) hücresinde bulunan sayısal degerleri textbox1"e nasıl toplam olarak yazdırabilirim...

yani degişkene baglı olarak cıkan degerleri toplatayım istiyorum...

kolay geslsin
 

Levent Menteşoğlu

Administrator
Yönetici
Admin
Katılım
13 Ekim 2004
Mesajlar
16,057
Excel Vers. ve Dili
Excel 2010-32 bit-Türkçe
Excel 365 -32 bit-Türkçe
Aşağıdaki gibi deneyin.

Kod:
[LEFT]Private Sub ComboBox2_Change()
ListBox1.Clear
For X = 2 To [A65536].End(3).Row
    If Left(Cells(X, 2), 50) = ComboBox2.Value And Left(Cells(X, 1), 50) = ComboBox1.Value Then
    c = c + 1
    ListBox1.AddItem
    ListBox1.List(c - 1, 0) = Sheets("SAYFA1").Cells(X, 1)
    ListBox1.List(c - 1, 1) = Sheets("SAYFA1").Cells(X, 2)
    ListBox1.List(c - 1, 2) = Sheets("SAYFA1").Cells(X, 28)
[B][COLOR=blue]toplam=Sheets("SAYFA1").cells(X,28)+toplam
[/COLOR][/B]    End If
Next
[COLOR=blue][B]textbox1=toplam[/B][/COLOR]
End Sub[/LEFT]
 
Katılım
11 Ağustos 2006
Mesajlar
87
Excel Vers. ve Dili
2000 türkçe
hocam test etmeden cevap verdim ozur dilerim

sadece (x,28) deki son hücreyi gosteriyor topla dedigimizde
 
Katılım
11 Ağustos 2006
Mesajlar
87
Excel Vers. ve Dili
2000 türkçe
toplam=Sheets("SAYFA1").cells(X,28)+toplam satırındaki
+toplamı kaldırınca hiçbir şey degişmiyor
 
Katılım
14 Şubat 2006
Mesajlar
3,426
Excel Vers. ve Dili
(Excel 2016 - İngilizce)
Altın Üyelik Bitiş Tarihi
30-11-2022
Normalde çalışması gerekiyor.

+toplam'ı kaldırmamanız gerekmektedir.
 
Katılım
11 Ağustos 2006
Mesajlar
87
Excel Vers. ve Dili
2000 türkçe
sadece son satırdaki (x,28) degeriini gosteriyor
 
Katılım
14 Şubat 2006
Mesajlar
3,426
Excel Vers. ve Dili
(Excel 2016 - İngilizce)
Altın Üyelik Bitiş Tarihi
30-11-2022
Ekteki örnekte görüldüğü gibi kodlar düzgün çalışıyor.

If Left(Cells(X, 2), 50) = ComboBox2.Value And Left(Cells(X, 1), 50) = ComboBox1.Value Then

satırında problem olabilir.
 
Katılım
11 Ağustos 2006
Mesajlar
87
Excel Vers. ve Dili
2000 türkçe
Private Sub ComboBox2_Change()
ListBox1.Clear
For X = 2 To [A65536].End(3).Row
If Cells(X, 2) = ComboBox2.Value And Cells(X, 1) = ComboBox1.Value Then
c = c + 1
ListBox1.AddItem
ListBox1.List(c - 1, 0) = Sheets("SAYFA1").Cells(X, 1)
ListBox1.List(c - 1, 1) = Sheets("SAYFA1").Cells(X, 2)
ListBox1.List(c - 1, 2) = Sheets("SAYFA1").Cells(X, 28)
toplam1 = Sheets("SAYFA1").Cells(X, 28) + toplam
End If
next
end sub

listbox herşeyi dogru gosteriyor.. bahsettiginiz satırda bir sorun oldugunu zannetmiyorum kafamın takıldıgı en son hücreyi gosteriyor olması
 
Katılım
14 Şubat 2006
Mesajlar
3,426
Excel Vers. ve Dili
(Excel 2016 - İngilizce)
Altın Üyelik Bitiş Tarihi
30-11-2022
toplam1 = Sheets("SAYFA1").Cells(X, 28) + toplam

satırında toplam1 değişkeni toplam olması olması gerekiyor.

Yani

toplam = Sheets("SAYFA1").Cells(X, 28) + toplam
 
Katılım
11 Ağustos 2006
Mesajlar
87
Excel Vers. ve Dili
2000 türkçe
Kod:
Private Sub ComboBox2_Change()
ListBox1.Clear
For X = 2 To [A65536].End(3).Row
    If Cells(X, 2) = ComboBox2.Value And Cells(X, 1) = ComboBox1.Value Then
    c = c + 1
    ListBox1.AddItem
    ListBox1.List(c - 1, 0) = Sheets("SAYFA1").Cells(X, 1)
    ListBox1.List(c - 1, 1) = Sheets("SAYFA1").Cells(X, 2)
    ListBox1.List(c - 1, 2) = Sheets("SAYFA1").Cells(X, 28)
    toplam1 = Sheets("SAYFA1").Cells(X, 28) + toplam1
    End If
    TextBox1 = toplam1
    Next
    For X = 2 To [A65536].End(3).Row
    If Cells(X, 2) = ComboBox2.Value Then
    toplam2 = Sheets("SAYFA1").Cells(X, 28) + toplam2
    End If
    TextBox2 = toplam2
    Next
End Sub
SUAN CALIŞIYOR TEŞEKKÜRLER
 
Üst