- Katılım
- 12 Nisan 2012
- Mesajlar
- 533
- Excel Vers. ve Dili
- Microsoft office professional plus 2019
- Altın Üyelik Bitiş Tarihi
- 18-12-2024
Merhaba Arkadaşlar.Aşağıdaki kod ile aynı anda Listbox1'den seçili veriyi Listbox3'e ve excel sayfasına kaydetmek istiyorum fakat listbox3'e ilave yaptığım zaman girdiğim son veri yerine Listbox3'ün tümündeki verileri excel sayfasına aktarıyor yapmak istediğim son girdiğim veriyi excel sayfasına aktarmak.Yardımcı olabilirseniz sevinirim.
xrow = Sheets("Liste").Cells(Rows.Count, "a").End(3).Row
For sat = 0 To ListBox3.ListCount - 1
For sut = 1 To 7
Sheets("Liste").Cells(sat + 1 + xrow, sut) = ListBox3.List(sat, sut - 1)
Next
Next
If ListBox1.ListIndex = -1 Then Exit Sub
Say = 1
For Bak = 0 To ListBox3.ListCount - 1
If ListBox3.List(Bak, 1) = ListBox1.List(ListBox1.ListIndex, 0) Then
Say = Int(ListBox3.List(Bak, 4)) + 1
Satir = Bak
Exit For
End If
Next
If Say = 1 Then
ListBox3.AddItem
Satir = ListBox3.ListCount - 1
End If
If ListBox1.ListIndex = -1 Then Exit Sub
For a = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(a) = True Then
ListBox3.List(Satir, 1) = ListBox1.List(ListBox1.ListIndex, 0)
ListBox3.List(Satir, 2) = ListBox1.List(ListBox1.ListIndex, 1)
ListBox3.List(Satir, 3) = TextBox1.Text
ListBox3.List(Satir, 4) = Say
ListBox3.List(Satir, 5) = Say * ListBox1.List(ListBox1.ListIndex, 1)
End If:
Next:
xrow = Sheets("Liste").Cells(Rows.Count, "a").End(3).Row
For sat = 0 To ListBox3.ListCount - 1
For sut = 1 To 7
Sheets("Liste").Cells(sat + 1 + xrow, sut) = ListBox3.List(sat, sut - 1)
Next
Next
If ListBox1.ListIndex = -1 Then Exit Sub
Say = 1
For Bak = 0 To ListBox3.ListCount - 1
If ListBox3.List(Bak, 1) = ListBox1.List(ListBox1.ListIndex, 0) Then
Say = Int(ListBox3.List(Bak, 4)) + 1
Satir = Bak
Exit For
End If
Next
If Say = 1 Then
ListBox3.AddItem
Satir = ListBox3.ListCount - 1
End If
If ListBox1.ListIndex = -1 Then Exit Sub
For a = ListBox1.ListCount - 1 To 0 Step -1
If ListBox1.Selected(a) = True Then
ListBox3.List(Satir, 1) = ListBox1.List(ListBox1.ListIndex, 0)
ListBox3.List(Satir, 2) = ListBox1.List(ListBox1.ListIndex, 1)
ListBox3.List(Satir, 3) = TextBox1.Text
ListBox3.List(Satir, 4) = Say
ListBox3.List(Satir, 5) = Say * ListBox1.List(ListBox1.ListIndex, 1)
End If:
Next: