unticking a tick box within a macro

  • Thread starter Thread starter The Grinch
  • Start date Start date
T

The Grinch

Hi All,

Is there any code I can add to a macro that will untick a given tic
box if it is ticked
 
when you say "tick box," do you mean a check box like those check boxe
that are found in the options dialog?

If there are specific options that are checked and you want to deselec
them then that is definitely possible.

I'm just not sure which boxes you are referring to..
 
They're actually called "Check boxes", they are little tickable boxe
selected from the control toolbar
 
Try this:

(I only tested it on two workbooks, but so far it is working for me)


Code
-------------------
Sub Make_All_Boxes_False()

Dim myObject As OLEObject

For Each myObject In ActiveSheet.OLEObjects

If InStr(1, myObject.ProgId, "CheckBox", vbBinaryCompare) > 1 Then

myObject.Object.Value = False

End If

Next

End Su
-------------------


Please let me know how it turns out.

-Kell
 
What should happen if it is not?

If it is to stay unchecked then

With ActiveSheet
.OLEObjects("Checkbox1").Object.Value = False
End With

If it should change also then

With ActiveSheet.OLEObjects("Checkbox1").Object
.Value = Not .Value
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Back
Top