Kodların farklı çalışması?

udentr2002

Altın Üye
Katılım
5 Kasım 2006
Mesajlar
1,478
Excel Vers. ve Dili
iş yerinde Office 365
evde Office 365
Altın Üyelik Bitiş Tarihi
07-11-2024
Merhaba arkadaşlar formun içindeki listboxlarda bulunan stünların toplamını aldırmak için formun initialize bölümüne aşağıdaki kodları yazdım gayet güzel çalışıyor
Kod:
For i = 0 To ListBox1.ListCount - 1
    toplam = ListBox1.Column(4, i) + toplam
    TextBox18 = toplam
Next
TextBox18.Text = Format(toplam, "#,##0.00")

For i = 0 To ListBox1.ListCount - 1
    toplamodenen = ListBox1.Column(6, i) + toplamodenen
    TextBox19 = toplamodenen
Next
TextBox19.Text = Format(toplamodenen, "#,##0.00")

For i = 0 To ListBox1.ListCount - 1
kalan = ListBox1.Column(7, i) + kalan
TextBox20 = kalan
Next
TextBox20 = Format(TextBox20, "#,##0.00")
initialize bölümünde sorun vermeden çalışıyor yanlız ben bu kodları yine aynı forum içerisinde comboboxdan arama yapınca yani comboboxun change özelliğinin altınada yazıyorum
yani bir nevi alt toplam almak isitiyorum comboboxdan listbox içindeki veriyi aratınca o veriye ait listboxdaki ilgili stünalrın toplamını aldırabilmek için.
fakat aynı kodları dediğim gibi comboboxun change özelliğinde

Kod:
Private Sub ComboBox1_Change()
ComboBox1 = Evaluate("=UPPER(" & """" & ComboBox1 & """" & ")")

ListBox1.RowSource = Empty
ListBox1.Clear
ListBox1.ColumnCount = 8
For Each isim In Sheets("DataBase").Range("c3:c" & Sheets("DataBase").Range("c65536").End(3).Row)
If UCase(LCase(isim)) Like UCase(LCase(ComboBox1)) & "*" Then
isim.Select
liste = ListBox1.ListCount
ListBox1.AddItem
ListBox1.List(liste, 0) = isim.Offset(0, -2).Text
ListBox1.List(liste, 1) = isim.Offset(0, -1).Text
ListBox1.List(liste, 2) = isim.Text
ListBox1.List(liste, 3) = isim.Offset(0, 1).Text
ListBox1.List(liste, 4) = isim.Offset(0, 2).Text
ListBox1.List(liste, 5) = isim.Offset(0, 3).Text
ListBox1.List(liste, 6) = isim.Offset(0, 4).Text
ListBox1.List(liste, 7) = isim.Offset(0, 5).Text



If ComboBox1.Text = "" Then
For X = 1 To 8
Controls("textbox" & X).Text = ""
Next
End If
End If
Next


For i = 0 To ListBox1.ListCount - 1
    toplam = ListBox1.Column(4, i) + toplam
    TextBox18 = toplam
Next
TextBox18.Text = Format(toplam, "#,##0.00")

For i = 0 To ListBox1.ListCount - 1
    toplamodenen = ListBox1.Column(6, i) + toplamodenen
    TextBox19 = toplamodenen
Next
TextBox19.Text = Format(toplamodenen, "#,##0.00")

For i = 0 To ListBox1.ListCount - 1
kalan = ListBox1.Column(7, i) + kalan
TextBox20 = kalan
Next
TextBox20 = Format(TextBox20, "#,##0.00")




End Sub
şeklinde kullanıyorum ama çalışmıyor daha doğrusu textboxlara listboxdaki stünları toplamıyor ordaki rakamları sadece yan yana yazıyor bunun sebebini çözemedim yardımcı olabilecek olan tüm arkadaşlarıma teşekkür ederim
 
Üst