Article ID: 150373
Article Last Modified on 10/11/2006
Sub SetCheckBoxes()
' Declare variables.
Dim GB As Object, CB As Object
' Set variables (makes the following lines much shorter).
Set DS = DialogSheets(1)
Set GB = DS.GroupBoxes(1)
' Loop through all of the check boxes on the dialog sheet.
For Each CB In DS.CheckBoxes
' Test if the check boxes' top-left corner is inside the group-
' box
If CB.Left > GB.Left And CB.Left < GB.Left + GB.Width And _
CB.Top > GB.Top And CB.Top < GB.Top + GB.Height Then
' If it is inside, then set the Value to xlOn.
CB.Value = xlOn
End If
Next
End Sub
Additional query words: XL
Keywords: kbhowto kbprogramming kbcode KB150373