Olmuyor yapamıyorum ListBox'a veri aktarmayı!!!

Katılım
4 Ekim 2004
Mesajlar
155
http://s11.yousendit.com/d.aspx?id=33PJPMFKWY2VP2INXZJIRF1U2K

dosya burada...
UserForm üzerinde ComboBox1 ve ComboBox2 var .Ve TextBox1 var.

Bunlara ben default değerler girdim..Þimdi bu 3 anahtara göre listeyi süzüp sadeleştirerek [(Giriş+( - Çıkış)] ayrıntıyı (Eldeki net stok miktarını) yine aynı form üzerindeki LİSTBOX1 DE Gösterecek..
ListBox1 aynen sheet deki başlıklar gibi 13 sütündan oluşacak...

ben bazı kodlar yazıp yaklaştığımı hissediyorum fakat gelmedi gerisi.sizlerden yardım istiyorum:

toplam1 = 0
For Each rnga In Range("H2:H" & Range("H65536").End(xlUp).Row)
If rnga.Value = TextBox1 And rnga.Offset(, -6) = ComboBox5 And rnga.Offset(, -5) = ComboBox6 And rnga.Offset(, 1) = ComboBox2 And rnga.Offset(, -2) = TextBox6 And rnga.Offset(, -3) = TextBox5 Then: toplam1 = toplam1 + rnga.Offset(0, 5).Value: toplam1y = toplam1y + rnga.Offset(0, 4).Value
ebt = UserForm2.ComboBox5.Value
klt = UserForm2.ComboBox6.Value
prt = rnga.Offset(, -3).Value
lt = rnga.Offset(, -2).Value
renk = rnga.Offset(, -1).Value
dkm = UserForm2.TextBox1

Next

lütfen üstteki linke tıklayıp örnek.xls i indiriniz....
 

Levent Menteşoğlu

Administrator
Yönetici
Admin
Katılım
13 Ekim 2004
Mesajlar
16,057
Excel Vers. ve Dili
Excel 2010-32 bit-Türkçe
Excel 365 -32 bit-Türkçe
Ã?ncelikte Textboxu silerek yerine combobox ekleyin ve tüm comboboxların rowsource özelliğine yazdığınız aralıkları silin. Daha sonra aşağıdaki kodları ait oldukları nesnelere yazın. Dosya ekleme özelliği aktif olduğunda bir örnek dosyada ekleyebilirim.

[vb:1:45bc222f02]Private Sub ComboBox1_Click()
[a1:m1].AutoFilter field:=2, Criteria1:=ComboBox1.Value
End Sub

Private Sub ComboBox2_Click()
[a1:m1].AutoFilter field:=3, Criteria1:=ComboBox2.Value
End Sub

Private Sub ComboBox3_Click()
[a1:m1].AutoFilter field:=8, Criteria1:=ComboBox3.Value
End Sub

Private Sub CommandButton1_Click()
Sheets("sayfa2").Columns("A:M").ClearContents
[a1].CurrentRegion.Copy
Sheets("sayfa2").[a1].PasteSpecial
Application.CutCopyMode = False
ListBox1.RowSource = "sayfa2!a2:m" & Sheets("sayfa2").Cells(65536, 1).End(xlUp).Row
End Sub

Private Sub UserForm_Initialize()
For a = 2 To Cells(65536, 1).End(xlUp).Row
If WorksheetFunction.CountIf(Range("B2:B" & a), Cells(a, 2)) = 1 Then
ComboBox1.AddItem Cells(a, 2).Value
End If
If WorksheetFunction.CountIf(Range("C2:C" & a), Cells(a, 3)) = 1 Then
ComboBox2.AddItem Cells(a, 3).Value
End If
If WorksheetFunction.CountIf(Range("H2:H" & a), Cells(a, 8)) = 1 Then
ComboBox3.AddItem Cells(a, 8).Value
End If
Next
[a1:m1].AutoFilter
ListBox1.ColumnHeads = True
ListBox1.ColumnCount = 13
ListBox1.TextAlign = fmTextAlignCenter
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
[a1:m1].AutoFilter
End Sub
[/vb:1:45bc222f02]
 
Katılım
4 Ekim 2004
Mesajlar
155
kodlar için teşekkürler..dediklerinizi aynen yaptım...

yalnız 432628 nolu dökümü ComboBox3 de seçtiğim zaman

ListBox1 'de bütün giriş çıkışları veriyor...zaman ilerledikçe giriş çıkışlarda artacağından listbox1 de kargaşa yaşanacak

ListBox1'de giriş çıkışları göstermeyip sadece kalan adedi göstererek tek satıra indirgeyebiliriz...çünkü operatör çıkış yapacağından listbox1 'i sade görmesi lazım....

lütfen üstteki yazdığımı dikkate alarak müsait zamanınızda bana dönerseniz cok sevinirim..
yeni düzeltmelerle dosyanın son hali aşağıdaki linkte...

http://s13.yousendit.com/d.aspx?id=0SYRGZH505LWP3CKP5CW9BLIVB
 
Katılım
20 Mayıs 2005
Mesajlar
48
Excel Vers. ve Dili
Excel2003 - Türkçe
Merhaba,
Þöyle birşey geldi aklıma tabi daha geliştirilmesi gerekli
forma bir tane daha ListBox2 yerleştiriniz
form kod sayfasına da şunu yazınız
[vb:1:3bdf642f50]Private Sub CommandButton1_Click()
ListBox2.Clear

Dim sayi
sayi = 0

For b = 0 To ListBox1.ListCount - 1

If ComboBox1.Value = ListBox1.List(b, 1) And ComboBox2.Value = ListBox1.List(b, 2) And TextBox1.Value = ListBox1.List(b, 7) Then

ListBox2.AddItem ListBox1.List(b, 0), sayi
ListBox2.List(sayi, 1) = ListBox1.List(b, 1)
ListBox2.List(sayi, 2) = ListBox1.List(b, 2)
ListBox2.List(sayi, 3) = ListBox1.List(b, 3)
ListBox2.List(sayi, 4) = ListBox1.List(b, 7)
ListBox2.List(sayi, 5) = ListBox1.List(b, 9)
ListBox2.List(sayi, 6) = ListBox1.List(b, 10)
ListBox2.List(sayi, 7) = ListBox1.List(b, 11)
ListBox2.List(sayi, 8) = ListBox1.List(b, 12)

sayi = sayi + 1
End If

Next b

ListBox2.AddItem ListBox1.List(0, 0), 0
ListBox2.List(0, 1) = ListBox1.List(0, 1)
ListBox2.List(0, 2) = ListBox1.List(0, 2)
ListBox2.List(0, 3) = ListBox1.List(0, 3)
ListBox2.List(0, 4) = ListBox1.List(0, 7)
ListBox2.List(0, 5) = ListBox1.List(0, 9)
ListBox2.List(0, 6) = ListBox1.List(0, 10)
ListBox2.List(0, 7) = ListBox1.List(0, 11)
ListBox2.List(0, 8) = ListBox1.List(0, 12)

End Sub

Private Sub UserForm_Activate()

ListBox1.ColumnCount = 13
ListBox2.ColumnCount = 9

Dim son
son = WorksheetFunction.CountA(Worksheets(ActiveSheet.Name).Range("M1:M65500"))
ListBox1.RowSource = ActiveSheet.Name & "!A1:M" & son
ListBox1.ListIndex = 0

End Sub[/vb:1:3bdf642f50]

Not:
1- ListBox1 i gizleyebilirsiniz kafa karıştırmasın diye

Kolay gelsin.
 

Levent Menteşoğlu

Administrator
Yönetici
Admin
Katılım
13 Ekim 2004
Mesajlar
16,057
Excel Vers. ve Dili
Excel 2010-32 bit-Türkçe
Excel 365 -32 bit-Türkçe
Sadece commandbutton1 in kodlarını aşağıdaki ile değiştirerek deneyin. Ayrıca örnek dosyada ektedir.

[vb:1:5b3879eb0c]Private Sub CommandButton1_Click()
[a1].CurrentRegion.Copy
Sheets("sayfa2").[a1].PasteSpecial
Application.CutCopyMode = False
Sheets("sayfa2").[j2] = WorksheetFunction.Sum(Sheets("sayfa2").[j2:j65536])
Sheets("sayfa2").[k2] = WorksheetFunction.Sum(Sheets("sayfa2").[k2:k65536])
Sheets("sayfa2").[l2] = WorksheetFunction.Sum(Sheets("sayfa2").[l2:l65536])
Sheets("sayfa2").[m2] = WorksheetFunction.Sum(Sheets("sayfa2").[m2:m65536])
Sheets("sayfa2").[a3:m65536].ClearContents
ListBox1.RowSource = "sayfa2!a2:m2"
End Sub[/vb:1:5b3879eb0c]
 
Üst