macro with checkbox(i)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a workbook with 4 worksheets
In a userform with 4 checkboxes i want to check if the sheets are visible
and if is true change the value of these checkboxes

for i=1 to 4
if sheets(i).visible=true then
checkbox(i).value=true
end if
next i

the problem is that is not recognize the checkbox(i) and give
me a compile error
"sub or function not defined"
 
For i = 1 To 4
If Worksheets(i).Visible Then
ActiveSheet.CheckBoxes(i).Value = True
End If
Next i
 
Since you said userform, there is no checkboxes collection.

for i=1 to 4
if sheets(i).visible=xlSheetVisible then
Userform1.Controls("checkbox" & i).value=true
end if
next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top