View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Error in code to Check Forms Checkbox

Sub Check()
Dim wks As Worksheet, chbx As checkbox

For Each wks In Worksheets("20", "21", "22", "78","87")
for each chbx in wks.CheckBoxes
chbx.Value = True
next
Next

End Sub


--
Regards,
Tom Ogilvy

"Steph" wrote in message
om...
Hello. This is a follow up question to a previously posted question.
I have the following code saved to my personal workbook:


Sub Check()
Dim wks As Worksheet, chbx As Object

For Each chbx In Worksheets("20", "21", "22", "78",
"87").CheckBoxes
chbx.Value = True
Next

End Sub

Where 20, 21, etc are the actual sheet names. When I run this, I get
a Comile Error: Wrong number of argumants or invalid property
assignment. And the Debugger is pointing to the word "Worksheets"

Any ideas what I am doing wrong? Thanks!!

-Steph