• DİKKAT

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

Listbox Döngü / Aynı Ürünleri kendi içinde toplama

  • Konbuyu başlatan Konbuyu başlatan walabi
  • Başlangıç tarihi Başlangıç tarihi

walabi

Altın Üye
Katılım
22 Eylül 2012
Mesajlar
1,080
Excel Vers. ve Dili
excel 2010

excel 2013
Merhaba,

Aşağıdaki kodlar ile textbox1 veri girildikten sonra, textbox2,3,4 ve 7 ye excel sayfasından veri çekiyorum, devamında listboxdaki 4 adet sütüna bu verileri aktarıyorum.
Textbox2 = Ürün Numarası, Tetbox3 = Ürün Adı, Textbox4 = Adet, Textbox7 = Tutar
Textbox1 e her veri girilmesinden sonra aynı ürünleri kendi içinde nasıl toplatabilirim. listbox ın 3. ve 4. sütunları, aynı ürünler kendi içinde toplanacak






Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)

If TextBox1 = "" Then
Cancel = False
Exit Sub
End If

Set bul = Sheets("Barkod").Range("B2:B65536").Find(TextBox1, LookAt:=xlWhole)
If TextBox1 = "*" Or bul Is Nothing Then
MsgBox " Böyle Bir Kayıtlı BARKOD Yok"
Cancel = True
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox7 = ""
Else
TextBox2 = Cells(bul.Row, "B")
TextBox3 = Cells(bul.Row, "C")
TextBox4 = Cells(bul.Row, "D") - Cells(bul.Row, "D") + 1
TextBox7 = Format(Replace(Cells(bul.Row, "F"), ".", ","), "0.00")
End If


' ************ aynı barkod numaralı olanlar toplatılacak **********




' ****************************************************************

If TextBox2.Value <> Empty And TextBox3.Value <> Empty And TextBox4.Value <> Empty And TextBox7.Value <> Empty Then

With ListBox1
.AddItem TextBox1.Text
.List(.ListCount - 1, 0) = TextBox2.Value
.List(.ListCount - 1, 1) = TextBox3.Value
.List(.ListCount - 1, 2) = TextBox4.Value
.List(.ListCount - 1, 3) = Replace(TextBox7.Value, ".", ",")


End With
End If




' **********************************************************
Dim i As Long, toplam As Double
For i = 1 To ListBox1.ListCount - 1
toplam = ListBox1.List(i, 3) + toplam
Next i

TextBox5.Text = Format(toplam, "0.00")
TextBox1.Value = Empty
TextBox1.SetFocus

End Sub
 
Geri
Üst