• DİKKAT

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

Textbox ve ComboBox ları ListBox'a aktarmak

ulutanas

Altın Üye
Katılım
8 Kasım 2008
Mesajlar
582
Excel Vers. ve Dili
Excel Vers. ve Dili Ofis 2021 TR 32 Bit
Arkadaşlar merhaba TextBox'ları ve ComboBox'ları Listbox'a aktaran mevcut bir kod mevcut lakin toplamda 9 adet text ve Combobox'lara bir tane daha ekleme yaptığımda 10. eklenen de hata veriyor.
Kod:
Private Sub CommandButton15_Click()
If TextBox23.Value = "" Then
    MsgBox "Sözleçme No boş olamaz!", vbCritical, "UYARI"
    TextBox26.SetFocus
    Exit Sub
End If
If TextBox26.Value = "" Then
    MsgBox "Açıklama boş olamaz!", vbCritical, "UYARI"
    TextBox26.SetFocus
    Exit Sub
End If
If TextBox27.Value = "" Then
    MsgBox "Birim boş olamaz!", vbCritical, "UYARI"
    TextBox27.SetFocus
    Exit Sub
End If
If Not IsNumeric(TextBox28.Value) Then
    MsgBox "Miktar sayısal bir değer olmalıdır!", vbCritical, "UYARI"
    TextBox28.SetFocus
    Exit Sub
End If
ListBox4.AddItem
ListBox4.List(ListBox4.ListCount - 1, 0) = ComboBox4.Value
ListBox4.List(ListBox4.ListCount - 1, 1) = Format(CDbl(TextBox24.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 2) = Format(CDbl(TextBox25.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 3) = ComboBox5.Value
ListBox4.List(ListBox4.ListCount - 1, 4) = TextBox26.Value
ListBox4.List(ListBox4.ListCount - 1, 5) = Format(CDbl(TextBox27.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 6) = Format(CDbl(TextBox28.Value), "#,##0")
ListBox4.List(ListBox4.ListCount - 1, 7) = Format(CDbl(TextBox29.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 8) = TextBox30.Value
ListBox4.List(ListBox4.ListCount - 1, 9) = Format(CDbl(TextBox31.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 10) = Format(CDbl(TextBox32.Value), "#,##0.00")

End Sub

End Sub


En son eklenen kodda hata veriyor 10 adet eklenemiyor mu acaba dedim, ama çözümü de vardır muhakkak :)
İyi çalışmalar dilerim,
Saygılarımla...
 
Listboxa additem motudu ile enfazla 10 sütun veri alabilirsiniz.Siz 11 sütun veri almışşsınız.İlk sütun 0 sıfırdan başlar.
Bunun yerine rowsource yöntemi ile veri alabilirsiniz.
Forumda listbox rowsurce diye arama yapınız.:cool:
 
Listboxa additem motudu ile enfazla 10 sütun veri alabilirsiniz.Siz 11 sütun veri almışşsınız.İlk sütun 0 sıfırdan başlar.
Bunun yerine rowsource yöntemi ile veri alabilirsiniz.
Forumda listbox rowsurce diye arama yapınız.:cool:

Hocam merhaba, forumda aradım sadece bu konu çıkıyor. Sanırım yeni site de birçok veri gitmiş.
 
additem metodu ile 2 listbox kullanırsanızda olur.:cool:
 
Son düzenleme:
Hacan ilginiz için teşekkür ederim, denedim oluyor lakin çirkin duruyor 2 adet listbox ????
14 adet textbox ve combobox ları listbox'a ekleyecek bir çözüm yokmu?
 
listbox2 yi propertiesten gizleyebilirsiniz.:cool:
 
Evren hocam 2 adet Listbox ekledim Textbox ve Comboboxları listbox lara aktarıyorum aşağıdaki kod ile
Kod:
Private Sub CommandButton15_Click()
If TextBox23.Value = "" Then
    MsgBox "Sözleçme No boş olamaz!", vbCritical, "UYARI"
    TextBox26.SetFocus
    Exit Sub
End If
If TextBox26.Value = "" Then
    MsgBox "Açıklama boş olamaz!", vbCritical, "UYARI"
    TextBox26.SetFocus
    Exit Sub
End If
If TextBox27.Value = "" Then
    MsgBox "Birim boş olamaz!", vbCritical, "UYARI"
    TextBox27.SetFocus
    Exit Sub
End If
If Not IsNumeric(TextBox28.Value) Then
    MsgBox "Miktar sayısal bir değer olmalıdır!", vbCritical, "UYARI"
    TextBox28.SetFocus
    Exit Sub
End If
ListBox5.AddItem
ListBox5.List(ListBox5.ListCount - 1, 0) = TextBox22.Value
ListBox5.List(ListBox5.ListCount - 1, 1) = ComboBox2.Value
ListBox5.List(ListBox5.ListCount - 1, 2) = TextBox23.Value
ListBox5.List(ListBox5.ListCount - 1, 3) = ComboBox3.Value
ListBox5.List(ListBox5.ListCount - 1, 4) = ComboBox4.Value
ListBox5.List(ListBox5.ListCount - 1, 5) = Format(CDbl(TextBox24.Value), "#,##0.00")
ListBox5.List(ListBox5.ListCount - 1, 6) = Format(CDbl(TextBox25.Value), "#,##0.00")
ListBox4.AddItem
ListBox4.List(ListBox4.ListCount - 1, 0) = ComboBox5.Value
ListBox4.List(ListBox4.ListCount - 1, 1) = TextBox26.Value
ListBox4.List(ListBox4.ListCount - 1, 2) = Format(CDbl(TextBox27.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 3) = Format(CDbl(TextBox28.Value), "#,##0")
ListBox4.List(ListBox4.ListCount - 1, 4) = Format(CDbl(TextBox29.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 5) = TextBox30.Value
ListBox4.List(ListBox4.ListCount - 1, 6) = Format(CDbl(TextBox31.Value), "#,##0.00")
ListBox4.List(ListBox4.ListCount - 1, 7) = Format(CDbl(TextBox32.Value), "#,##0.00")

End Sub


Burada sorun yok fakat listbox'ları sayfaya aktarırken aşağıdaki kodu kullanıyorum ama userform açılmadan hata veriyor nerede hata yaptım ona da
bakabilir misiniz size zahmet :cool:

Kod:
Private Sub CommandButton17_Click()
Dim FED As Long, i As Long
If TextBox23.Value = "" Then
    MsgBox "Sözleşme No BOŞ OLAMAZ!", vbCritical, "UYARI"
    TextBox2.SetFocus
    Exit Sub
End If

FED = Sheets("KAYITLAR").Range("A65536").End(xlUp).Row + 1
For i = 0 To ListBox5.ListCount - 1
    Sheets("KAYITLAR").Cells(FED, "A").Value = CDate(ListBox5.List(i, 0))
    Sheets("KAYITLAR").Cells(FED, "B").Value = CDbl(ListBox5.List(i, 1))
    Sheets("KAYITLAR").Cells(FED, "C").Value = CDbl(ListBox5.List(i, 2))
    Sheets("KAYITLAR").Cells(FED, "D").Value = CDbl(ListBox5.List(i, 3))
    Sheets("KAYITLAR").Cells(FED, "e").Value = CDbl(ListBox5.List(i, 4))
    Sheets("KAYITLAR").Cells(FED, "F").Value = CDbl(ListBox5.List(i, 5))
    Sheets("KAYITLAR").Cells(FED, "G").Value = CDbl(ListBox5.List(i, 6))
  
FED = FED + 1
Next i
ED = Sheets("KAYITLAR").Range("I65536").End(xlUp).Row + 1
For i = 0 To ListBox4.ListCount - 1
    Sheets("KAYITLAR").Cells(FED, "h").Value = CDbl(ListBox4.List(i, 0))
    Sheets("KAYITLAR").Cells(FED, "ı").Value = CDbl(ListBox4.List(i, 1))
    Sheets("KAYITLAR").Cells(FED, "j").Value = CDbl(ListBox4.List(i, 2))
    Sheets("KAYITLAR").Cells(FED, "k").Value = CDbl(ListBox4.List(i, 3))
    Sheets("KAYITLAR").Cells(FED, "l").Value = CDbl(ListBox4.List(i, 4))
    Sheets("KAYITLAR").Cells(FED, "m").Value = CDbl(ListBox4.List(i, 5))
    Sheets("KAYITLAR").Cells(FED, "n").Value = CDbl(ListBox4.List(i, 6))
    Sheets("KAYITLAR").Cells(FED, "o").Value = CDbl(ListBox4.List(i, 7))

End Sub
 
Sayısal olmayan verilere cdbl vba fonksiyonunu yazmadan direk nesneyi yazdırın.:cool:
 
Sanırım siz konuya tersten bakıyorsunuz.Verileri nesnelerden direk sayfaya yazın ve sonra listboxa rowsource ile verileri almalısınız.:cool:
 
Her cevabınız aklıma farklı fikirler getiriyor hocam ???? Çok teşekkür ederim ????
 
Evren hocam yeniden merhaba, aşağıdaki kod ile textbox ve combobox ları sayfaya aktarıyorum ve bu aktarılanları listbox4 de görüyorum, burada sıkıntı yok 4 beş kayıt birden yapıyorum.

Kod:
Private Sub CommandButton15_Click()
If TextBox23.Value = "" Then
    MsgBox "Sözleçme No boş olamaz!", vbCritical, "UYARI"
    TextBox23.SetFocus
    Exit Sub
End If
If TextBox26.Value = "" Then
    MsgBox "Açıklama boş olamaz!", vbCritical, "UYARI"
    TextBox26.SetFocus
    Exit Sub
End If
If TextBox27.Value = "" Then
    MsgBox "Birim boş olamaz!", vbCritical, "UYARI"
    TextBox27.SetFocus
    Exit Sub
End If
If Not IsNumeric(TextBox28.Value) Then
    MsgBox "Miktar sayısal bir değer olmalıdır!", vbCritical, "UYARI"
    TextBox28.SetFocus
    Exit Sub
End If
FED = Sheets("veri").Range("A65536").End(xlUp).Row + 1
Sheets("veri").Range("A" & FED).Value = TextBox22.Text
Sheets("veri").Cells(FED, "b").Value = ComboBox2.Value
Sheets("veri").Cells(FED, "c").Value = TextBox23.Value
Sheets("veri").Cells(FED, "d").Value = ComboBox3.Value
Sheets("veri").Cells(FED, "e").Value = ComboBox4.Value
Sheets("veri").Cells(FED, "f").Value = TextBox24.Text
Sheets("veri").Cells(FED, "g").Value = CDbl(TextBox25.Value)
Sheets("veri").Cells(FED, "h").Value = ComboBox5.Value
Sheets("veri").Cells(FED, "ı").Value = TextBox26.Text
Sheets("veri").Cells(FED, "j").Value = CDbl(TextBox27.Value)
Sheets("veri").Cells(FED, "K").Value = TextBox28.Text
Sheets("veri").Cells(FED, "L").Value = CDbl(TextBox29.Value)
Sheets("veri").Cells(FED, "M").Value = TextBox30.Text
Sheets("veri").Cells(FED, "N").Value = CDbl(TextBox31.Value)
Sheets("veri").Cells(FED, "O").Value = CDbl(TextBox32.Value)
ListBox4.ColumnCount = 15
ListBox4.RowSource = "veri!A2:O" & Sheets("veri").Range("B65536").End(xlUp).Row
ListBox4.ColumnWidths = "50;120;90;110;110;50;50;50;70;50;60;60;60;60;60"

End Sub

Ama listbox veri sayfasından alığı satırları kayırlar sayfasına aktarım yaptığımda aşağıdaki kod ile listbox daki sadece son satırı ektarıyor.
Kod:
Private Sub CommandButton17_Click()
Dim FED As Long, i As Long
If TextBox23.Value = "" Then
    MsgBox "Sözleşme No BOŞ OLAMAZ!", vbCritical, "UYARI"
    TextBox23.SetFocus
    Exit Sub
End If

FED = Sheets("KAYITLAR").Range("A65536").End(xlUp).Row + 1
For i = 0 To ListBox4.ListCount - 1
    Sheets("KAYITLAR").Cells(FED, "A").Value = ListBox4.List(i, 0)
    Sheets("KAYITLAR").Cells(FED, "B").Value = ListBox4.List(i, 1)
    Sheets("KAYITLAR").Cells(FED, "C").Value = ListBox4.List(i, 2)
    Sheets("KAYITLAR").Cells(FED, "D").Value = ListBox4.List(i, 3)
    Sheets("KAYITLAR").Cells(FED, "e").Value = ListBox4.List(i, 4)
    Sheets("KAYITLAR").Cells(FED, "F").Value = ListBox4.List(i, 5)
    Sheets("KAYITLAR").Cells(FED, "G").Value = ListBox4.List(i, 6)
    Sheets("KAYITLAR").Cells(FED, "h").Value = CDbl(ListBox4.List(i, 7))
    Sheets("KAYITLAR").Cells(FED, "ı").Value = ListBox4.List(i, 8)
    Sheets("KAYITLAR").Cells(FED, "j").Value = CDbl(ListBox4.List(i, 9))
    Sheets("KAYITLAR").Cells(FED, "k").Value = ListBox4.List(i, 10)
    Sheets("KAYITLAR").Cells(FED, "l").Value = CDbl(ListBox4.List(i, 11))
    Sheets("KAYITLAR").Cells(FED, "m").Value = ListBox4.List(i, 12)
    Sheets("KAYITLAR").Cells(FED, "n").Value = CDbl(ListBox4.List(i, 13))
    Sheets("KAYITLAR").Cells(FED, "o").Value = CDbl(ListBox4.List(i, 14))

Next i
Sheets("veri").Range("A2:O30").ClearContents

End Sub

Listboxdaki bütün satırları aktarmak için yukarıdaki kodda nasıl bir değişiklik yapmalıyım.

Saygılarımla...
 
Gerçek kayıtların olmadığı örnek dosyanızı eklerseniz,daha iyi olur kanaatindeyim.:cool:
 
Hangi userform ve sayfaya bakılacak?
 
Userform da Anasayfa içinde page2 cari kayıtlara. bakılacak. Dosya içerisindr kayıtlat sayfasına aktarımda sıkıntı var
 
Userform da Anasayfa içinde page2 cari kayıtlara. bakılacak. Dosya içerisindr kayıtlat sayfasına aktarımda sıkıntı var
Listbox4 veriyi KAYITLAR sayfasındanmı alacak?Veri sayfasında veri yok.İnitialize olayında veri sayfasından almış verileri.:cool:
 
textbox ve combonoxları doldurup listeye aktar dışına basınca veri sayfasına aktarıyor. listbox4 veri sayfasındaki bilgileri gösteriyor. kaydet tuşu ile listbox4 deki verileri kayıtlar sayfasına aktarıyor ama son satırı aktarıyor hocam. aslında ters yoldan gidiyor.
Aslında yapmak istediğim textbox ve combobox ları doldurup listbox4 e aktarmak 4-5 kayıt girince bir müşteri için kaydet tuşu ile listbox4 deki verileri kayıtlar sayfasına aktarmak istiyorum :)
 
textbox ve combonoxları doldurup listeye aktar dışına basınca veri sayfasına aktarıyor. listbox4 veri sayfasındaki bilgileri gösteriyor. kaydet tuşu ile listbox4 deki verileri kayıtlar sayfasına aktarıyor ama son satırı aktarıyor hocam. aslında ters yoldan gidiyor.
Aslında yapmak istediğim textbox ve combobox ları doldurup listbox4 e aktarmak 4-5 kayıt girince bir müşteri için kaydet tuşu ile listbox4 deki verileri kayıtlar sayfasına aktarmak istiyorum :)
4-5 kayıt olmaz .Her satır için yeni kayıt olmalı.İşler böyle yürüyor bu camiada.
Listboxa tıklayınca veriler boxlara aktarılıyor.Kaydet tuşuna basınca sayfaya kaydediyor.Ve listboxa alıyor verileri(KAYIT sayfasından)
Dosyanız ektedir.:cool:
 

Ekli dosyalar

14 adet textbox olunca işler böyle yürüyor ise yapacak bir şey yok demek ki. Bu da böyle olsun bari ????

İlgi ve alakanızdan dolayı çok teşekkür ederim hocam.
İyi çalışmalar,
Saygılarımla...
 
Rica ederim.
İyi çalışmalar.:cool:
 
Geri
Üst