Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uncheck checksboxes code not working

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
US
Hi all, using excel 2003...

I have a form with 6 checkboxes, that I want to clear out. I have not changed the default name, so they are checkbox1, checkbox2, checkbox3, etc.

I tried using
Code:
Sheets("sheet1").checkbox4.Value = False


But I get a "Object doesn't support this property or method" error.

I found the code below and used it to detect all checkboxes. I have the below code in Module1

Code:
Sub Uncheck() Dim oCB As OLEObject With Sheets("Sheet1") For Each oCB In .OLEObjects If TypeName(oCB.Object) = "CheckBox" Then oCB.Object.Value = False End If Next oCB End With End Sub

Then in my workbook I call it after the user hits a button...
Code:
Call Uncheck

I check all my boxes, run the code, and nothing happens.

Any ideas of what I'm doing wrong.. this might be soo easy i'm making it more difficult than it is.....
 
This should work.
Code:
Sheets("sheet1").Shapes("checkbox4").OLEFormat.Object.Value = False

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top