Unchecking all Forms checkboxes in entire sheet

M

michaelberrier

I found this great code for unchecking all Form Toolbar created
checkboxes on a single sheet:


Sub Clearem()
Dim bx as object
For each bx in Worksheets("Sheet1").Checkboxes
bx.value = xlOff
Next
End Sub

How can I adapt this to uncheck all boxes in an entire workbook? I've
tried Activebook and workbook("") with no luck.

Thanks in adavnce.
 
J

jeff.j.griffith

Use this code:

Dim objWorksheet As Worksheet

For Each objWorksheet In ActiveWorkbook.Worksheets
'Your For loop goes here
Next objWorksheet
 
P

Peter T

No need to loop Forms type checkboxes

Worksheets("Sheet1").CheckBoxes.Value = xlOff ' or xlOn checked

xlOff is -4146 but 0 also works, xlOn is +1

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top