View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Can I Group Form Check Boxes?

do you mean forms as in checkboxes from the forms toolbar (or do you mean
activeX checkboxes from the control toolbox toolbar also known as MSForms).

for the first

Activesheet.Checkboxes.Value = xloff

for the 2nd

for each ctrl in Worksheets("Sheet1").OleObjects
if typeof ctrl is MSforms.CheckBox then
set cb = ctrl.Object
cb.Value = False
end if
Next


But it sounds like you want to work on a subset of the checkboxes.

If so, I would use the topleftcell property test its location on the sheet
with the intersect method

if not intersect(ctrl.TopLeftCell, Range("A1:F20")) is nothing then
ctrl.object.Value = False
End if

you can use similar with the controls from the Forms toolbar

for each cb in Worksheets("Sheet1").Checkboxes
if not intersect(cb.TopLeftCell, Range("A1:F20")) is nothing then
cb.Value = xlOff
end if
Next


--
Regards,
Tom Ogilvy

"JK" wrote in message news:MBpWc.34$6b.32@trnddc04...
I have 90 checkboxes on a worksheet and a CmdBtn to clear the selections.

Is
there a way to group the checkboxes so I can clear them in one simple
procedure? Or am I stuck having to list each checkbox separately in a
procedure like If Sheets("Sheet1).CheckBox1.Value=True Then
Sheets("Sheet1).CheckBox1.Value=False, etc.

Thank you.
Regards,
Jim Kobzeff