Selam arkadaşlar,
Hazırladığım komple bir muhasebe programı var. hotels programıma benziyor.
Userform da ListView öğesine checkbox ekledim. Burada işaretlediğim checkbox ların toplamını almak istiyorum fakat başaramadım. kod şöyle;
Nerede hata yaptığımı bulamadım. Yardımcı olursanız memnun olurum.
Dim ChequeTotal As Double
Sheets("ChequeBook").Select
Set Sh = ActiveSheet
EndRow = Sh.Cells(65536, 1).End(xlUp).Row
With ListView1
.ListItems.Clear
For i = StartRow To EndRow
.ListItems.Add , , Sh.Cells(i, 1)
x = x + 1
With .ListItems(x).ListSubItems
.Add , , Sh.Cells(i, 2)
.Add , , FormatDateTime(Sh.Cells(i, 3), vbGeneralDate)
.Add , , Sh.Cells(i, 4)
.Add , , Format(Sh.Cells(i, 5), "#,##0.00")
.Add , , i
'Checkbox işaretlediğim zaman toplam alsın istiyorum...
If ListView1.ListItems.Item(x).Checked = True Then
ChequeTotal = ChequeTotal + ListView1.ListItems x).SubItems(4)
Else
' Burada Listview toplamlarını alıyor....
ChequeTotal = ChequeTotal + ListView1.ListItems(x).SubItems(4)
End If
End With
Next i
End With
TextBox18.Value = Format(ChequeTotal, "#,##0.00")
------ BENZER YARDIM ARAYAN OLURSA AŞAĞIDAKİ KODDA Checkbox SEÇİLİNCE EXCEL E AKTARMAK İÇİN ÖRNEK----
EndRow = ListView1.ListItems.count
For S = 1 To ListView1.ListItems.count
If ListView1.ListItems.Item(S).Checked = True Then
s1.Cells(S + 19, "A") = ListView1.ListItems(S) * 1
s1.Cells(S + 19, "B") = ListView1.ListItems(S).SubItems(1)
s1.Cells(S + 19, "C") = ListView1.ListItems(S).SubItems(2)
s1.Cells(S + 19, "D") = ListView1.ListItems(S).SubItems(3)
s1.Cells(S + 19, "E") = ListView1.ListItems(S).SubItems(4)
s1.Cells(S + 19, "F") = ListView1.ListItems(S).SubItems(5)
s1.Cells(S + 19, "G") = Format(ListView1.ListItems(S).SubItems(6), "#,##0.00") * 1
ChequeTotal = ChequeTotal + ListView1.ListItems(S).SubItems(6)
End If
Next
Hazırladığım komple bir muhasebe programı var. hotels programıma benziyor.
Userform da ListView öğesine checkbox ekledim. Burada işaretlediğim checkbox ların toplamını almak istiyorum fakat başaramadım. kod şöyle;
Nerede hata yaptığımı bulamadım. Yardımcı olursanız memnun olurum.
Dim ChequeTotal As Double
Sheets("ChequeBook").Select
Set Sh = ActiveSheet
EndRow = Sh.Cells(65536, 1).End(xlUp).Row
With ListView1
.ListItems.Clear
For i = StartRow To EndRow
.ListItems.Add , , Sh.Cells(i, 1)
x = x + 1
With .ListItems(x).ListSubItems
.Add , , Sh.Cells(i, 2)
.Add , , FormatDateTime(Sh.Cells(i, 3), vbGeneralDate)
.Add , , Sh.Cells(i, 4)
.Add , , Format(Sh.Cells(i, 5), "#,##0.00")
.Add , , i
'Checkbox işaretlediğim zaman toplam alsın istiyorum...
If ListView1.ListItems.Item(x).Checked = True Then
ChequeTotal = ChequeTotal + ListView1.ListItems x).SubItems(4)
Else
' Burada Listview toplamlarını alıyor....
ChequeTotal = ChequeTotal + ListView1.ListItems(x).SubItems(4)
End If
End With
Next i
End With
TextBox18.Value = Format(ChequeTotal, "#,##0.00")
------ BENZER YARDIM ARAYAN OLURSA AŞAĞIDAKİ KODDA Checkbox SEÇİLİNCE EXCEL E AKTARMAK İÇİN ÖRNEK----
EndRow = ListView1.ListItems.count
For S = 1 To ListView1.ListItems.count
If ListView1.ListItems.Item(S).Checked = True Then
s1.Cells(S + 19, "A") = ListView1.ListItems(S) * 1
s1.Cells(S + 19, "B") = ListView1.ListItems(S).SubItems(1)
s1.Cells(S + 19, "C") = ListView1.ListItems(S).SubItems(2)
s1.Cells(S + 19, "D") = ListView1.ListItems(S).SubItems(3)
s1.Cells(S + 19, "E") = ListView1.ListItems(S).SubItems(4)
s1.Cells(S + 19, "F") = ListView1.ListItems(S).SubItems(5)
s1.Cells(S + 19, "G") = Format(ListView1.ListItems(S).SubItems(6), "#,##0.00") * 1
ChequeTotal = ChequeTotal + ListView1.ListItems(S).SubItems(6)
End If
Next