View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Andy Andy is offline
external usenet poster
 
Posts: 15
Default Checkbox from toolbox


Thank you Leith. Works perfectly.

Just to clarify and hopefully learn something in the process.

So the word OLEobjects refers to all control toolbox buttons, checkboxes
etc on the sheet.

So the code counts all the OLEObjects on the sheet. Using a for loop It
then checks each one to ensure it is a checkbox and then assigns the
value FALSE (unchecked).

Thanks again

Andy

Leith Ross wrote:
Hello Andy,

This will clear all the checkboxes it finds on the active worksheet,
regardless of their names. Copy this code and placce it in a VBA
module.


Code:
--------------------
Sub ClearAllCheckBoxes()

Dim ChkBoxId As String

ChkBoxId = "Forms.CheckBox.1"

With ActiveSheet
For I = 1 To .OLEObjects.Count
If .OLEObjects(I).ProgId = ChkBoxId Then
.OLEObjects(I).Object.Value = False
End If
Next I
End With

End Sub

--------------------

Sincerely,
Leith Ross