• DİKKAT

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

Aktif listbox seçili iken diğer listbox nesnelerindeki seçimler iptal olsun

hamitcan

Uzman
Uzman
Katılım
1 Temmuz 2004
Mesajlar
7,769
Excel Vers. ve Dili
Excel 2019 Türkçe
Aşağıdaki kod bir class module uygulaması. Yapmak istediğim ise, aktif listbox içinde bir satır seçili iken diğer listbox nesnelerindeki seçimler iptal olsun. Aşağıdaki kod bazen bu şekilde çalışıyor, bazen çalışmıyor. Nerede hata yaptığımı bulamadım.

Şimdiden teşekkürler.
Kod:
Public WithEvents Lbox As MSForms.ListBox
Private Sub Lbox_Click()
With UserForm1
Select Case .ActiveControl.Name
    Case "ListBox1": .ListBox2.ListIndex = -1: .ListBox3.ListIndex = -1: .ListBox4.ListIndex = -1
    Case "ListBox2": .ListBox3.ListIndex = -1: .ListBox4.ListIndex = -1: .ListBox1.ListIndex = -1
    Case "ListBox3": .ListBox4.ListIndex = -1: .ListBox2.ListIndex = -1: .ListBox1.ListIndex = -1
    Case "ListBox4": .ListBox1.ListIndex = -1: .ListBox2.ListIndex = -1: .ListBox3.ListIndex = -1
End Select
End With
End Sub
 
Class Module deki kodu aşağıdaki ile değiştirin.

Kod:
Public WithEvents Lbox As MSForms.ListBox
Private Sub Lbox_Click()
For a = 1 To 4
If Lbox.Name <> UserForm1.Controls("listbox" & a).Name Then UserForm1.Controls("listbox" & a).ListIndex = -1
Next
End Sub
 
Te&#351;ekk&#252;rler &#220;stad&#305;m. Ellerine sa&#287;l&#305;k, &#231;ok g&#252;zel &#231;al&#305;&#351;&#305;yor.
 
Geri
Üst