Ester
Zet er een teller op.
Dim Teller As Integer
Teller = 0
En dan telkens je een selectievakje aanklikt:
If ****Selectievakje***** .Value = True Then
Teller = Teller + 1
Else
Teller = Teller -1
End If
If Teller = 2 Then
If Selectievakje.Value = False
Selectievakje.Enabled = False
End If
End If
Je zal natuurlijk overal waar ik Selectievakje gebruikt heb, dit moeten
vervangen door de naam van uw selectievakje.
Luc
"ester" <este...@hotmail.com> schreef in bericht
news:060d01c2e246$56d31f60$a401...@phx.gbl...
Ook een mogelijkheid, althans waar het gaat om checkboxen op het werkblad
vanuit de werkset besturingselementen.
Zodra een derde kruisje wordt geplaatst worden beide andere uitgeschakeld.
Ik kan hier echter helaas geen gebruik maken van een opsomming van de
checkboxen d.m.v. Activesheet("Checkbox" & i) waarbij je i laat lopen van 1
tot 6. Vandaar dat ik ze allemaal voluit moet schrijven.
Voor 6 checkboxen:
Option Explicit
Private Sub CheckBox1_Click()
MaxTwee 1
End Sub
Private Sub CheckBox2_Click()
MaxTwee 2
End Sub
Private Sub CheckBox3_Click()
MaxTwee 3
End Sub
Private Sub CheckBox4_Click()
MaxTwee 4
End Sub
Private Sub CheckBox5_Click()
MaxTwee 5
End Sub
Private Sub CheckBox6_Click()
MaxTwee 6
End Sub
Sub MaxTwee(intChk As Integer)
Dim intMax As Integer
With ActiveSheet
intMax = Abs(.CheckBox1 + .CheckBox2 + .CheckBox3 + .CheckBox4 +
.CheckBox5 + .CheckBox6)
If intMax > 2 Then
Select Case intChk
Case 1
'.CheckBox1 = False
.CheckBox2 = False
.CheckBox3 = False
.CheckBox4 = False
.CheckBox5 = False
.CheckBox6 = False
Case 2
.CheckBox1 = False
'.CheckBox2 = False
.CheckBox3 = False
.CheckBox4 = False
.CheckBox5 = False
.CheckBox6 = False
Case 3
.CheckBox1 = False
.CheckBox2 = False
'.CheckBox3 = False
.CheckBox4 = False
.CheckBox5 = False
.CheckBox6 = False
Case 4
.CheckBox1 = False
.CheckBox2 = False
.CheckBox3 = False
'.CheckBox4 = False
.CheckBox5 = False
.CheckBox6 = False
Case 5
.CheckBox1 = False
.CheckBox2 = False
.CheckBox3 = False
.CheckBox4 = False
'.CheckBox5 = False
.CheckBox6 = False
Case 6
.CheckBox1 = False
.CheckBox2 = False
.CheckBox3 = False
.CheckBox4 = False
.CheckBox5 = False
'.CheckBox6 = False
End Select
End If
End With
End Sub