Value change even does not work if Checkbox used

Kamolga

Well-known Member
Joined
Jan 28, 2015
Messages
1,185
Hi,

I have checkboxes in cells (one per cell) that are related to those cell. They allow a user to select criteria but I wish he could select 6 maximum, so anytime one is used, I would like to count how many "True" I already have in that range (called 'TrueCriteria'). If I use the below macro, the event happens if I change the value manually from true to false but not if I do so using the checkbox



VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 8 Then
Dim i As Long: i = Application.WorksheetFunction.CountIf([TrueCriteria], True)
MsgBox i
End If
End Sub
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Clicking a checkbox, does not trigger a change event, try putting the code into the check boxes
 
Upvote 0
I'm curious, what do you want to happen when the seventh check box is checked.
Do you want it to BEEP and refuse to become checked?
Or do you want one of the previously checked boxes to become unchecked, if so, which box?
 
Upvote 0
I'm curious, what do you want to happen when the seventh check box is checked.
Do you want it to BEEP and refuse to become checked?
Or do you want one of the previously checked boxes to become unchecked, if so, which box?
The idea is to make a list of all selected criteria selected and show it in the messagbox. If we have 6 already, I would just show the six previously selected and ask for user to unselect one before selecting the one he wanted (and put target.value to false).
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,790
Messages
6,121,608
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top