• DİKKAT

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

listbox3'deki seçilen veri sütun halinde listbox2'ye gelsin

Katılım
4 Ekim 2004
Mesajlar
155
istbox3 ve Listbox2 olan 3 sütunlu Userform üzernde iki nesne var elimde.

Listbox3'deki 3 sütunlu veriye tıklayınca neden tamamen 3 sütun olarak listbox2 'ye aktarılamıyor. sadece tek sütunu aktarıyor!!
Bu kodumda sadece ilk sütunu alıyor, AMA SEÇTİĞİM LİSTBOX3 İÇİNDE DİĞER SÜTUNLARDAKİ VERİLER DE LİSTBOX2ye GELSİN.

NEREYİ DEĞİŞTİRMEM GEREK, ÇOK YAKLAŞTIM AMA YAPAMIYORUM.


Private Sub ListBox3_Click()

Dim iCnt As Integer
For iCnt = 0 To Me.ListBox3.ListCount - 1
If Me.ListBox3.Selected(iCnt) = True Then
Me.ListBox2.AddItem Me.ListBox3.List(iCnt)
End If
Next

End Sub
 
Merhaba

Örnekteki "UserForm_Initialize" ve "ListBox3_Click" altıdaki kodları inceleyiniz daha anlaşılır olabilir.
https://www.dosyaupload.com/50bf
Kod:
[SIZE="2"]Private Sub ListBox3_Click()
Dim iCnt As Integer
For iCnt = 0 To Me.ListBox3.ListCount - 1
If Me.ListBox3.Selected(iCnt) = True Then
Me.ListBox2.AddItem Me.ListBox3.List(iCnt)

[COLOR="Blue"]a = ListBox2.ListCount - 1
Me.ListBox2.List(a, 1) = Me.ListBox3.List(iCnt, 1)
Me.ListBox2.List(a, 2) = Me.ListBox3.List(iCnt, 2)[/COLOR]

End If
Next[/SIZE]
Kod:
 [SIZE="2"]
Private Sub UserForm_Initialize()

[COLOR="Blue"]ListBox2.ColumnCount = 3
ListBox3.ColumnCount = 3[/COLOR]

Set s1 = Sheets("Sayfa1")
rw = s1.Cells(Rows.Count, 1).End(3).Row

For a = 1 To rw
ListBox3.AddItem s1.Cells(a, 1)
ListBox3.List(n, 1) = Cells(a, 2)
ListBox3.List(n, 2) = Cells(a, 3)
n = n + 1
Next

End Sub [/SIZE]
 
Geri
Üst