Hi, I'm new to this forum and a newbie to coding with vba. I've searched the net for a solution for my current problem, but haven't found any suitable solution yet. Maybe some of you here can help me. Ok, to the topic: I have a set of checkboxes (form control) and I'd like to write a vba code to control if all checkboxes are FALSE (or value = 0). If so, I simply want a MsgBox to appear and then Exit Sub. I've written a code that goes loops through all checkboxes, but it doesn't give the desired end result if all checkboxes are FALSE. Here's the code I have so far:
For Each cb In ActiveSheet.Shapes
If cb.Type = msoFormControl Then
If cb.FormControlType = xlCheckBox Then
If cb.ControlFormat.Value = 0 Then
iX = iX + 1
If iX = 0 Then
MsgBox "No checkboxes are selected"
Range("B3").Select
Exit Sub
End If
End If
End If
End If
Next cb
Any ideas?
Cheers,
Magne E.
Bookmarks