clear checkbox

H

happyPotter

I'm trying to complete a simple task. On my Transfer worksheet and on
my Delete worksheet, I have a command button called Clear and I would
like it to clear checkbox 3 and checkbox4 from the active sheet. I put
checks in checkbox 3 and checkbox4 and when I click the Clear button
nothing happens. The checkmarks are still there.
i tried this code but keeps giving me error "unable to get oleobjects
property of worksheet class"

'Worksheets("transfer").OLEObjects("CheckBox3").Object.Value =
False

I also tried and still it doesn't work for me

checkbox3 = 0
checkbox3.value = false


I'm using excel 97.



Sub Button20_Click()

'worksheet Transfer clear

Worksheets("transfer").Select
CheckBox3 = False
CheckBox4 = False

end
 
G

Guest

I found this code in a Ron de Bruin message. Give it a try.
(It will set all checkboxes to False.)

Option Explicit
Dim obj
Sub ClearBox()
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is MSForms.CheckBox Then
obj.Object.Value = False
End If
Next
End Sub
 

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