• DİKKAT

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

Hücreden listbox a veri almak

  • Konbuyu başlatan Konbuyu başlatan bebar
  • Başlangıç tarihi Başlangıç tarihi
Katılım
12 Kasım 2014
Mesajlar
255
Excel Vers. ve Dili
2013
Merhaba,

3 Kolonu ve 4 satırı olan bir listbox kullanıyorum hücreden veri almam gerekiyor aşağıdaki gibi bir kod kullandım fakat çalışmıyor.

Yardımcı olursanız memnun olurum.

ListBox1.Clear

ListBox1.List(1, 0).AddItem s1.Range("D1").Value
ListBox1.List(2, 0).AddItem s1.Range("D2").Value
ListBox1.List(3, 0).AddItem s1.Range("D4").Value

ListBox1.List(1, 1).AddItem s1.Range("P1").Value
ListBox1.List(2, 1).AddItem s1.Range("P2").Value
ListBox1.List(3, 1).AddItem s1.Range("P4").Value

ListBox1.List(1, 2).AddItem s1.Range("AB1").Value
ListBox1.List(2, 2).AddItem s1.Range("AB2").Value
ListBox1.List(3, 2).AddItem s1.Range("AB4").Value

ListBox1.List(1, 3).AddItem s1.Range("AN1").Value
ListBox1.List(2, 3).AddItem s1.Range("AN2").Value
ListBox1.List(3, 3).AddItem s1.Range("AN4").Value

birde böyle denedim yine olmadı

ListBox1.List(0, 1).AddItem s1.Range("D1").Value
ListBox1.List(0, 2).AddItem s1.Range("P1").Value
ListBox1.List(0, 3).AddItem s1.Range("AB1").Value
ListBox1.List(0, 4).AddItem s1.Range("AN1").Value

ListBox1.List(1, 1).AddItem s1.Range("D2").Value
ListBox1.List(1, 2).AddItem s1.Range("P2").Value
ListBox1.List(1, 3).AddItem s1.Range("AB2").Value
ListBox1.List(1, 4).AddItem s1.Range("AN2").Value

ListBox1.List(2, 1).AddItem s1.Range("D4").Value
ListBox1.List(2, 2).AddItem s1.Range("P4").Value
ListBox1.List(2, 3).AddItem s1.Range("AB4").Value
ListBox1.List(2, 4).AddItem s1.Range("AN4").Value
 
Son düzenleme:
Örnek dosya eklerseniz arkadaşlar daha kolay yardımcı olabilir.
 
AllahuAlem böyle bir şey istiyorsunuz
Kod:
Private Sub UserForm_Initialize()
Dim Sons, Satr As Long
ListBox1.Clear
ListBox1.ColumnWidths = "40;40;40;40"
ListBox1.ColumnCount = 4
Sons = Sheets(1).Range("A65536").End(xlUp).Row
For Satr = 2 To Sons
    ListBox1.AddItem
    ListBox1.List(ListBox1.ListCount - 1, 0) = Sheets(1).Cells(Satr, 1)
    ListBox1.List(ListBox1.ListCount - 1, 1) = Sheets(1).Cells(Satr, 2)
    ListBox1.List(ListBox1.ListCount - 1, 2) = Sheets(1).Cells(Satr, 3)
    ListBox1.List(ListBox1.ListCount - 1, 3) = Sheets(1).Cells(Satr, 4)
Next Satr
End Sub
 

Ekli dosyalar

Geri
Üst