- Katılım
- 26 Eylül 2020
- Mesajlar
- 171
- Excel Vers. ve Dili
- excel 2019 pro.Türkçe
- Altın Üyelik Bitiş Tarihi
- 26-09-2021
Arkadaşlar merhaba.Aşağıdaki kod ile listbox toplamı alıyorum ama kodu çalştırmak için "Toplam"adlı commandbutton kullanmak zorunda kalıyorum.Listbox'ın click olayına öyle bir kod yazalımki veriyi girdiğimde otomatik olarak textbox^daki değer değişsin.Eğer öyle yapmazsak Textboxdaki eski değeri dikkate alıp yanlışlık yapabiliriz.
Dim i As Long, t1 As Double
For i = 0 To Sheets("Anasayfa").ListBox3.ListCount - 1
topla = topla + CDbl(Sheets("Anasayfa").ListBox3.List(i, 5))
Next i
Sheets("Anasayfa").TextBox9.Text = topla
TextBox9 = Format(TextBox9, vbCrLf & "#,##0 TL")
Listbox'ın click olayı için kodu ekliyorum.İyi çalışmalar
Dim i As Long
If ListBox1.ListIndex = -1 Then Exit Sub
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) = True Then
ListBox3.AddItem 'ListBox1.List(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 1) = ListBox1.List(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 2) = ListBox1.List(i, 1)
End If
Next i
Dim i As Long, t1 As Double
For i = 0 To Sheets("Anasayfa").ListBox3.ListCount - 1
topla = topla + CDbl(Sheets("Anasayfa").ListBox3.List(i, 5))
Next i
Sheets("Anasayfa").TextBox9.Text = topla
TextBox9 = Format(TextBox9, vbCrLf & "#,##0 TL")
Listbox'ın click olayı için kodu ekliyorum.İyi çalışmalar
Dim i As Long
If ListBox1.ListIndex = -1 Then Exit Sub
For i = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(i) = True Then
ListBox3.AddItem 'ListBox1.List(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 1) = ListBox1.List(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 2) = ListBox1.List(i, 1)
End If
Next i
Son düzenleme: