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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Excel Checkboxes set Value

Status
Not open for further replies.

dprayner

Programmer
Oct 14, 2002
140
US
Hi people. I am have trouble with something that should be simple and straight-forward. When a Workbook is open, I want to make sure the Value of some of my Checkboxes are False. I am trying to use this approach:
With Sheet1.
For i = 1 to 30
.CheckBox(i).Value = False
Next i
End With

It comes up with a Compile error: Method or Data Member not found.

How can I do this without listing all 30 CheckBox statements separately? DO I need to loop through the spreadsheet controls?

Thanks, DAVE
 


Hi,

FYI -- How to use the Watch Window as a Power Programming Tool faq707-4594

What kind of checkbox?

On a userform, on a sheet?

Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
Hi Skip. I am using CheckBoxes on a Sheet this time. I usually user UserForms though. DAVE
 


Code:
Sub CheckBoxesX()
    Dim shp As Shape, x
    For Each shp In ActiveSheet.Shapes
        With shp
            Select Case .Type
                Case msoOLEControlObject
                    Select Case Split(.OLEFormat.ProgId, ".")(1)
                        Case "CheckBox"
                            .OLEFormat.Object.Object = False
                        Case "ComboBox"
                    End Select
            End Select
        End With
    Next
End Sub

Skip,

[glasses] [red]Be Advised![/red] Coeds studying ancient Egyptian plumbing, might be known as...
Pharaoh Faucet Majors [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top