Limit Selected Check Boxes With Collection Logic

Limit Selected Check Boxes With Collection Logic

Use the Count property to determine exactly how many controls are loaded. You can also use the For Each loop to perform code on each control. For instance, if you have a control array of check boxes and you don’t want more than three checked, use this code:

 Private Sub Check1_Click(Index As Integer)	Dim chk As CheckBox	Dim lCnt As Long	Const cMAX = 3	For Each chk In Check1		If chk.Value = vbChecked Then			lCnt = lCnt + 1			If lCnt > cMAX Then				Check1(Index).Value = vbUnchecked				MsgBox "Too many checked!"				Exit For			End If		End If	Next chkEnd Sub
Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular