sachin katariya
New Member
- Joined
- Jul 13, 2020
- Messages
- 21
- Office Version
- 2013
- Platform
- Windows
Private Sub CheckBox1_Change()
Dim Count As Integer
Count = 0
If CheckBox1.Value = True Then Count = Count + 1
If CheckBox2.Value = True Then Count = Count + 1
If CheckBox3.Value = True Then Count = Count + 1
If CheckBox4.Value = True Then Count = Count + 1
If CheckBox5.Value = True Then Count = Count + 1
If CheckBox6.Value = True Then Count = Count + 1
If CheckBox7.Value = True Then Count = Count + 1
If CheckBox8.Value = True Then Count = Count + 1
If CheckBox9.Value = True Then Count = Count + 1
If CheckBox10.Value = True Then Count = Count + 1
If CheckBox11.Value = True Then Count = Count + 1
If CheckBox12.Value = True Then Count = Count + 1
If CheckBox13.Value = True Then Count = Count +1
If Count > 8 Then CheckBox1.Value = False
End Sub
Please any one can simplify this
Dim Count As Integer
Count = 0
If CheckBox1.Value = True Then Count = Count + 1
If CheckBox2.Value = True Then Count = Count + 1
If CheckBox3.Value = True Then Count = Count + 1
If CheckBox4.Value = True Then Count = Count + 1
If CheckBox5.Value = True Then Count = Count + 1
If CheckBox6.Value = True Then Count = Count + 1
If CheckBox7.Value = True Then Count = Count + 1
If CheckBox8.Value = True Then Count = Count + 1
If CheckBox9.Value = True Then Count = Count + 1
If CheckBox10.Value = True Then Count = Count + 1
If CheckBox11.Value = True Then Count = Count + 1
If CheckBox12.Value = True Then Count = Count + 1
If CheckBox13.Value = True Then Count = Count +1
If Count > 8 Then CheckBox1.Value = False
End Sub
Please any one can simplify this