• DİKKAT

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

Listbox'da hata

Katılım
8 Haziran 2007
Mesajlar
401
Excel Vers. ve Dili
excel fonksiyonlar
Forumda emeği geçen herkese merhaba. Arkadaşlar bir butona atadığım aşağıdaki kodlar son satır hariç doğru çalışıyor. Fakat son satır run-time error
380 diye bir hata veriyor. (son satır = ListBox1.List(ListBox1.ListCount - 1, 10) = .Cells(i, "Q").Value ). Bu satırı sildiğimde kodlar çalışıyor. Eklediğimde hata veriyor. Nasıl bir yanlışlık yaptım acaba ? İlgilenen arkadaşlara
şimdiden teşekkürler. :)

Dim syf3 As Worksheet
Set syf3 = Worksheets("MAÇ_PROĞRAMI")

ListBox1.Clear
Dim i As Byte
ListBox1.ColumnCount = 11
ListBox1.ColumnWidths = "25;80;120;120;50;30;30;30;30;30;40"
With syf3
For i = 4 To 16
ListBox1.AddItem .Cells(i, "E").Value ' E sütunu
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(i, "F").Value ' F Sütunu
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(i, "G").Value ' G Sütunu
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(i, "I").Value ' I Sütunu
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(i, "J").Value ' j Sütunu
ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(i, "K").Value ' K Sütunu
ListBox1.List(ListBox1.ListCount - 1, 6) = .Cells(i, "L").Value ' L Sütunu
ListBox1.List(ListBox1.ListCount - 1, 7) = .Cells(i, "M").Value ' M Sütunu
ListBox1.List(ListBox1.ListCount - 1, 8) = .Cells(i, "N").Value ' N Sütunu
ListBox1.List(ListBox1.ListCount - 1, 9) = .Cells(i, "O").Value ' O Sütunu
ListBox1.List(ListBox1.ListCount - 1, 10) = .Cells(i, "Q").Value ' Q Sütunu

Next i
End With
i = Empty
 
Merhaba,

Rowsource kullanmalısınız. Bildiğim kadarıyla AddItem de sınır 10 sütundur.
 
Merhaba,

Rowsource kullanmalısınız. Bildiğim kadarıyla AddItem de sınır 10 sütundur.

Hocam kendimce RowSource'u da denedim. Fakat aynı tip hatayı veriyor. belki ben kodu doğru yazamamış olabilirim. Sadece bu kısmını düzenleyebilir misiniz ?
İlginiz için teşekkürler. :)
 
Hocam kendimce RowSource'u da denedim. Fakat aynı tip hatayı veriyor. belki ben kodu doğru yazamamış olabilirim. Sadece bu kısmını düzenleyebilir misiniz ?
İlginiz için teşekkürler. :)

Merhaba.
"H" sütunda veri yok mu?
Kod:
ListBox1.AddItem .Cells(i, "E").Value ' E sütunu
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(i, "F").Value ' F Sütunu
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(i, "G").Value ' G Sütunu
[COLOR="Red"]ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(i, "h").Value[/COLOR] ' I Sütunu
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(i, "ı").Value ' j Sütunu
 
Hocam kendimce RowSource'u da denedim. Fakat aynı tip hatayı veriyor. belki ben kodu doğru yazamamış olabilirim. Sadece bu kısmını düzenleyebilir misiniz ?
İlginiz için teşekkürler. :)

Bu şekilde deneyin. Arada istemediğiniz sütun varsa genişliklerini 0 yaparsınız.

Kod:
Private Sub UserForm_Initialize()
 
    With ListBox1
        .Clear
        .ColumnCount = 13
        .ColumnWidths = "25;80;120;120;50;30;30;30;30;30;40;30;30"
        .RowSource = "'MAÇ_PROĞRAMI'!$E$4:$Q$16"
    End With
 
End Sub
.
 
Bu şekilde deneyin. Arada istemediğiniz sütun varsa genişliklerini 0 yaparsınız.

Kod:
Private Sub UserForm_Initialize()
 
    With ListBox1
        .Clear
        .ColumnCount = 13
        .ColumnWidths = "25;80;120;120;50;30;30;30;30;30;40;30;30"
        .RowSource = "'MAÇ_PROĞRAMI'!$E$4:$Q$16"
    End With
 
End Sub
.

Hocam bu şekliyle daha iyi oldu. Çok teşekkür ederim. :) Mutlu yıllar. :)
 
Geri
Üst