Using a for loop to cycle through some checkboxes seems like a piece of cake only my code won't work. I must be missing something easy...
First, these are NOT activex checkboxes but form control checkboxes on a worksheet. For reference the following code line has always worked to set the value of the form control.
Sheet1.CheckBox26.Value = False
So here is the basic loop. This is being used in the Workbook_Open sub.
Private Sub Workbook_Open()
Dim chkBox as CheckBox
'other code
For Each chkBox In Sheets("Field Service Report").CheckBoxes
chkBox.Value = False
Next chkBox
'other code
End Sub
I've tried various iterations of this concept with various definitions. I have read a few different places that they used this code in the sheet area. I don't know if that makes a difference. I do other formatting and value setting on this worksheet in the workbook_open sub without issue.
Aucun commentaire:
Enregistrer un commentaire