• DİKKAT

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

Lİstbox'ta Sadece İstediğim Sütunlar Görünsün

Katılım
3 Haziran 2017
Mesajlar
797
Excel Vers. ve Dili
2007, 32
Arkadaşlar,

Aşağıdaki kod ile "liste" isimi sayfamın hepsi ListBox'ta görünüyor.
Ben sadece A ve B sütunlarının görünmesini istiyorum.

İlginiz için şimdiden teşekkür ediyorum.

Kod:
Private Sub ListBox1_DubleClick()
Dim k As Range, sonsat As Long
Sheets("liste").Select
sonsat = Cells(Rows.Count, "B").End(xlUp).Row
Set k = Range("B2:B" & sonsat).Find(ListBox1.Column(1), , xlValues, xlWhole)
If Not k Is Nothing Then

    Range("A" & k.Row & ":G" & k.Row).Select
    UserForm3.TextBox7.Text = Cells(ActiveCell.Row, "h")
    
    UserForm3.TextBox1.Text = Cells(ActiveCell.Row, "b")
    UserForm3.TextBox2.Text = Cells(ActiveCell.Row, "c")
    UserForm3.TextBox3.Text = Cells(ActiveCell.Row, "d")
    UserForm3.TextBox4.Text = Cells(ActiveCell.Row, "e")
    UserForm3.TextBox5.Text = Cells(ActiveCell.Row, "f")
    UserForm3.TextBox6.Text = Cells(ActiveCell.Row, "g")

End If

End Sub
 
Bedri bey,

Verdiğiniz kod Listbox nesnesine veri yüklemiyor. Çift tıklama olayıdır.

Bu işlemi yapan farklı bir kod olması gerekiyor.
 
Bedri bey,

Verdiğiniz kod Listbox nesnesine veri yüklemiyor. Çift tıklama olayıdır.

Bu işlemi yapan farklı bir kod olması gerekiyor.

Haklısınız Korhan Hocam.
Aşağıdaki kod ile istediğimi yaptım.

Kod:
Private Sub UserForm_Initialize()
    With Userform2.ListBox1
        .ColumnCount = 2
        .ColumnWidths = "100;600"
        .ColumnHeads = True
        .RowSource = "liste!a2:b65536"
    End With
End Sub

Şimdi de şunda takıldım.
Aşağıdaki koda eğer Listbox'tan bir satır mause ile seçilmeden Checkbox işaretlenmişse "Önce listeden bir soru seçiniz!" uyarısı vermesini istiyorum.

İlginiz için çok teşekkür ederim.

Kod:
Private Sub CheckBox1_Click()
Dim k As Range, sonsat As Long
Sheets("liste").Select
sonsat = Cells(Rows.Count, "B").End(xlUp).Row
Set k = Range("B2:B" & sonsat).Find(ListBox1.Column(1), , xlValues, xlWhole)
If Not k Is Nothing Then

    Range("A" & k.Row & ":G" & k.Row).Select
    UserForm3.TextBox7.Text = Cells(ActiveCell.Row, "h")
    
    UserForm3.TextBox1.Text = Cells(ActiveCell.Row, "b")
    UserForm3.TextBox2.Text = Cells(ActiveCell.Row, "c")
    UserForm3.TextBox3.Text = Cells(ActiveCell.Row, "d")
    UserForm3.TextBox4.Text = Cells(ActiveCell.Row, "e")
    UserForm3.TextBox5.Text = Cells(ActiveCell.Row, "f")
    UserForm3.TextBox6.Text = Cells(ActiveCell.Row, "g")

End If

End Sub
 
Geri
Üst