For each visible checkbox between i to 20.
If checkbox(i).value = 0 'if unticked
then checkbox.visible = False
End if
Next
in my head the code would go something like this but can't quite figure out the exact syntax
Rich (BB code):For each visible checkbox between i to 20. If checkbox(i).value = 0 'if unticked then checkbox.visible = False End if Next
[COLOR=#333333]Sub SetCheckboxes()[/COLOR] Dim cb As CheckBox
For Each cb In ActiveSheet.CheckBoxes
if cb.visible = true then cb.Visible = cb.Value = 1
Next
[COLOR=#333333]End Sub[/COLOR]
You can also write the highlighted line of code this way...Code:[COLOR=#333333]Sub SetCheckboxes()[/COLOR] Dim cb As CheckBox For Each cb In ActiveSheet.CheckBoxes [B][COLOR="#FF0000"]if cb.visible = true then cb.Visible = cb.Value = 1[/COLOR][/B] Next [COLOR=#333333]End Sub[/COLOR]