• DİKKAT

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

ListBox seçimine göre OptionButtona veri çağrılması

Hakan ERDOST

Destek Ekibi
Destek Ekibi
Katılım
12 Eylül 2004
Mesajlar
885
Excel Vers. ve Dili
Excel 2019 Türkçe (Ev)
Excel 2013 Türkçe (Okul)
Kod:
Private Sub CommandButton1_Click()
On Error Resume Next
Sheets("Mat_Tema_1").Visible = True
Sheets("Mat_Tema_1").Select
[A1].Select

son = Range("c65536").End(3).Row + 1

Columns(3).Find(ListBox1.Value).Select
If ActiveCell = ListBox1.Value Then
For a = 1 To 17
Cells(ActiveCell.Row, a + 3) = ""
If Controls("Optionbutton" & a) = True Then Cells(ActiveCell.Row, a + 3) = 1
If Controls("Optionbutton" & a + 17) = True Then Cells(ActiveCell.Row, a + 3) = 2
If Controls("Optionbutton" & a + 34) = True Then Cells(ActiveCell.Row, a + 3) = 3
If Controls("Optionbutton" & a + 51) = True Then Cells(ActiveCell.Row, a + 3) = 4
Next a
MsgBox "Notlar değiştirildi"
Exit Sub
End If

For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then Cells(son, 3) = ListBox1.List(i, 0)
Next

For a = 1 To 17
If Controls("Optionbutton" & a) = True Then Cells(son, a + 3) = 1
If Controls("Optionbutton" & a + 17) = True Then Cells(son, a + 3) = 2
If Controls("Optionbutton" & a + 34) = True Then Cells(son, a + 3) = 3
If Controls("Optionbutton" & a + 51) = True Then Cells(son, a + 3) = 4
Next a
MsgBox "Yeni öğrenci ve notları eklendi"
Sheets("Mat_Tema_1").Select 'Sayfayı seçiyor.
ActiveWindow.SelectedSheets.Visible = False 'Seçili sayfayı gizliyor..

End Sub
Yukarıdaki koda hangi ilave ile listboxdaki seçime göre eğer ilgili kişiye ait veri var ise ilgili userformdaki optionbuttonlara ver gelecek şekilde düzenleyebiliriz.
 
Geri
Üst