- Katılım
- 3 Mart 2009
- Mesajlar
- 519
- Excel Vers. ve Dili
- excel 2003 tr
Arkadaşlar şimdiden kolay gelsin, acaba ben bu kodların neresinde hata yapıyorum olmuyor?
örnek dosya ektedir..
class1
modül
sayfa
örnek dosya ektedir..
class1
Kod:
Public WithEvents Optbox As MSForms.OptionButton
'Private WithEvents Optbox As MSForms.OptionButton
Private Sub Optbox_Change()
Dim ctl As MSForms.OptionButton
If Optbox.Value = True Then
Optbox.BackColor = RGB(255, 0, 0)
For Each ctl In Optbox.Parent.Controls
If TypeName(ctl) = "OptionButton" Then
If ctl.Value = False Then
ctl.BackColor = vbButtonFace
End If
End If
Next
End If
End Sub
Private Sub Optbox_Click()
Cells(1, 1) = Optbox.Name
End Sub
modül
Kod:
Dim Opt(1 To 5) As New Class1 ' change 5 to number of optionButtons
Sub Opt_Kon()
Dim ctl As OLEObject
Dim i As Long
For Each ctl In Sheets("X").OLEObjects
If TypeName(ctl) = "OptionButton" Then
i = i + 1
Set Opt(i) = New Class1
Set Opt(i).Optbox = ctl
End If
Next
End Sub
sayfa
Kod:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call Opt_Kon
Cells(2, 1) = "FFFF"
End Sub
