• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

listbox a süzülüp gelen sayıları alt alta toplamını almak

Katılım
24 Aralık 2008
Mesajlar
71
Excel Vers. ve Dili
2007 türkçe
--------------------------------------------------------------------------------

bi listboxum var ve burada bi combobox tan tarih seçildiğinde o tarihe ait satışlar listbox a geliyor.. ve benim istediğim de o satış miktarlarını yani seçilip listbox a gelen satış miktarları toplamını bi textbox a yazdırmak..
 
yanıt

Kod:
Private Sub ComboBox1_Change()
Dim sat As Integer
ListBox1.ColumnCount = 2
ListBox1.Clear
TextBox1 = Empty
    For sat = 1 To Cells(65536, "a").End(xlUp).Row
        If Cells(sat, "a") Like ComboBox1 & "*" Then
            ListBox1.AddItem
            ListBox1.List(s, 0) = Format(Cells(sat, "a"), "dd.mm.yyyy")
            ListBox1.List(s, 1) = Cells(sat, "b")
            s = s + 1
            TextBox1 = Val(TextBox1) + Cells(sat, "b")
        End If
    Next
End Sub
Kod:
Private Sub UserForm_Initialize()
Dim sat, s As Integer
    For sat = 1 To Cells(65536, "a").End(xlUp).Row
        If Not WorksheetFunction.CountIf(Range("a1:a" & sat), Cells(sat, "a")) > 1 Then
            ComboBox1.AddItem
            ComboBox1.List(s, 0) = Format(Cells(sat, "a"), "dd.mm.yyyy")
            s = s + 1
        End If
    Next
End Sub
 

Ekli dosyalar

Kod:
Private Sub ComboBox1_Change()
Dim sat As Integer
ListBox1.ColumnCount = 2
ListBox1.Clear
TextBox1 = Empty
    For sat = 1 To Cells(65536, "a").End(xlUp).Row
        If Cells(sat, "a") Like ComboBox1 & "*" Then
            ListBox1.AddItem
            ListBox1.List(s, 0) = Format(Cells(sat, "a"), "dd.mm.yyyy")
            ListBox1.List(s, 1) = Cells(sat, "b")
            s = s + 1
            TextBox1 = Val(TextBox1) + Cells(sat, "b")
        End If
    Next
End Sub
Kod:
Private Sub UserForm_Initialize()
Dim sat, s As Integer
    For sat = 1 To Cells(65536, "a").End(xlUp).Row
        If Not WorksheetFunction.CountIf(Range("a1:a" & sat), Cells(sat, "a")) > 1 Then
            ComboBox1.AddItem
            ComboBox1.List(s, 0) = Format(Cells(sat, "a"), "dd.mm.yyyy")
            s = s + 1
        End If
    Next
End Sub

Aslında demek istediğimi çok iyi anlamışsınız ..!yani aynen sizin de yolladığınız örnekte ki gibi bi userform combobox ve listbox var ..Comboboxtan tarihi seçip altınabi buton eklemiştim ben göster butonuna tıklanınca o tarihe ait veriler listbox a geliyor..
ben o gelen verilerden o güne ait karı toplamak istiyorum .. örnek yollayacağım ama bende ki 2007 ofis isterseniz yollayım yada siz bu sizin öreneğiniz de yapın .. yolladığınız örnek çalışmıyor ama
 
Geri
Üst