View Single Post
 
Old 04-27-2021, 04:12 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You could use:
Code:
Private Sub CommandButton1_Click()
Dim oCtr As Control
Dim bChecked As Boolean
    For Each oCtr In Me.Controls
        If TypeName(oCtr) = "CheckBox" And oCtr.value = True Then
            bChecked = True
            Exit For
        End If
    Next
    If Not bChecked = True Then
        MsgBox "You must tick at least one.", vbCritical
        GoTo lbl_Exit
    End If
    'a checkbox is checked so do stuff
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote