- Kod: Tümünü seç
Private Sub CommandButton1_Click()
On Error Resume Next
Sheets("Gorsel").Visible = True
Sheets("Gorsel").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 27
Cells(ActiveCell.Row, a + 3) = ""
If Controls("Optionbutton" & a) = True Then Cells(ActiveCell.Row, a + 3) = 1
If Controls("Optionbutton" & a + 27) = True Then Cells(ActiveCell.Row, a + 3) = 2
If Controls("Optionbutton" & a + 54) = True Then Cells(ActiveCell.Row, a + 3) = 3
If Controls("Optionbutton" & a + 81) = 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 27
If Controls("Optionbutton" & a) = True Then Cells(son, a + 3) = 1
If Controls("Optionbutton" & a + 27) = True Then Cells(son, a + 3) = 2
If Controls("Optionbutton" & a + 54) = True Then Cells(son, a + 3) = 3
If Controls("Optionbutton" & a + 81) = True Then Cells(son, a + 3) = 4
Next a
MsgBox "Yeni öğrenci ve notları eklendi"
Sheets("Gorsel").Select 'Sayfayı seçiyor.
ActiveWindow.SelectedSheets.Visible = False 'Seçili sayfayı gizliyor..
End Sub
Yukarıdaki kod ile form üzerindeki Optionbutton seçimlerimi ilgili sayfaya aktarıyorum. istediğim ise; OptionButtonları tek tek işaretlemek yerine, commandbuttona yazacağım bir kod ile örneğin hepsini 4 seçtirmem-işaretlemem mümkün mü?