• DİKKAT

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

Listbox Listeleme

Katılım
5 Mart 2012
Mesajlar
14
Excel Vers. ve Dili
2003+2010
Arkadaşlar merhaba,

ComboBox1 ve ComboBox2 ile seçim yapıp seçim Parametre sayfasından ve ListBox1 listelenmesini ve TextBox'lara toplam aldırmak istedim kendi çalışmam üzerinde baya uğraştım ama sitedeki örneklere de baktım ama işin içinden çıkamadım bu konuda yardımlarınızı bekliyorum kolay gelsin.
 

Ekli dosyalar

Kodlarınız.

Kod:
Private Sub ComboBox1_Change()
Dim sat, s As Long
ListBox1.Clear
ListBox1.ColumnCount = 9
'ListBox1.ColumnWidths = "kolon genişlik"
    For sat = 1 To Cells(65536, "A").End(xlUp).Row
        If Cells(sat, "D") Like ComboBox1 Then
            ListBox1.AddItem
            ListBox1.List(s, 0) = Cells(sat, "B")
            ListBox1.List(s, 1) = Cells(sat, "C")
            ListBox1.List(s, 2) = Cells(sat, "D")
            ListBox1.List(s, 3) = Cells(sat, "E")
            ListBox1.List(s, 4) = Format(Cells(sat, "G"), "dd.mm.yyyy")
            ListBox1.List(s, 5) = Cells(sat, "AC")
            ListBox1.List(s, 6) = Cells(sat, "AD")
            ListBox1.List(s, 7) = Cells(sat, "AE")
            ListBox1.List(s, 8) = Cells(sat, "AF")
            s = s + 1
        End If
    Next
Call topla
End Sub

Private Sub ComboBox2_Change()
Dim sat, s As Long
ListBox1.Clear
ListBox1.ColumnCount = 9
'ListBox1.ColumnWidths = "kolon genişlik"
    For sat = 1 To Cells(65536, "A").End(xlUp).Row
        If Cells(sat, "E") Like ComboBox2 Then
            ListBox1.AddItem
            ListBox1.List(s, 0) = Cells(sat, "B")
            ListBox1.List(s, 1) = Cells(sat, "C")
            ListBox1.List(s, 2) = Cells(sat, "D")
            ListBox1.List(s, 3) = Cells(sat, "E")
            ListBox1.List(s, 4) = Format(Cells(sat, "G"), "dd.mm.yyyy")
            ListBox1.List(s, 5) = Cells(sat, "AC")
            ListBox1.List(s, 6) = Cells(sat, "AD")
            ListBox1.List(s, 7) = Cells(sat, "AE")
            ListBox1.List(s, 8) = Cells(sat, "AF")
            s = s + 1
        End If
    Next
Call topla
End Sub

Private Sub UserForm_Initialize()
Dim sat As Long, i As Long
sat = Cells(65536, "A").End(xlUp).Row
For i = 2 To sat
    If WorksheetFunction.CountIf(Range("D2:D" & i), Cells(i, "D").Value) = 1 Then
        ComboBox1.AddItem Cells(i, "D").Value
    End If
    If WorksheetFunction.CountIf(Range("E2:E" & i), Cells(i, "E").Value) = 1 Then
        ComboBox2.AddItem Cells(i, "E").Value
    End If
Next
End Sub

Sub topla()
Dim i As Long, hedyi As Double, kyi As Double, eykyi As Double, ki As Double
For i = 0 To ListBox1.ListCount - 1
    hedyi = hedyi + ListBox1.List(i, 5)
    kyi = kyi + ListBox1.List(i, 6)
    eykyi = eykyi + ListBox1.List(i, 7)
    ki = ki + ListBox1.List(i, 8)
Next
TextBox1.Value = hedyi
TextBox2.Value = kyi
TextBox3.Value = eykyi
TextBox4.Value = ki
End Sub
 
Teşekkürler Kuman.
 
Geri
Üst