Thread: clear checkbox
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Hudson Ken Hudson is offline
external usenet poster
 
Posts: 186
Default clear checkbox

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
--
Ken Hudson


"happyPotter" wrote:


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").Ob ject.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


--
happyPotter
------------------------------------------------------------------------
happyPotter's Profile: http://www.excelforum.com/member.php...fo&userid=1510
View this thread: http://www.excelforum.com/showthread...hreadid=384598