Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Error in code to Check Forms Checkbox

whoops - missed that you were using the "array" directly:

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

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

End Sub

or
Sub Check()
Dim wks As Worksheet, chbx As checkbox
Dim varr as Variant
varr = Array("20", "21", "22", "78","87")
For Each wks In Worksheets(varr)
for each chbx in wks.CheckBoxes
chbx.Value = xlOn
next
Next

End Sub


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Increase size of a Forms Check Box (click on to enter check mark) 718Satoshi Excel Discussion (Misc queries) 0 August 17th 07 01:52 AM
Forms Checkbox Jo Excel Discussion (Misc queries) 2 February 19th 07 04:01 AM
How do I resize the actual Forms checkbox Nel Excel Discussion (Misc queries) 1 March 22nd 06 09:23 PM
EXCEL FORMS CHECKBOX BLUOVAL Excel Worksheet Functions 3 October 17th 05 06:40 PM
Uncheck Forms Check box via code Steph[_3_] Excel Programming 1 April 2nd 04 01:00 AM


All times are GMT +1. The time now is 08:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"