LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default Check boxes not working

Wow, I guess that must have been my mistake. I didn't know there were two
types of check boxes. Tom, the code you sent me worked perfectly. This will
enable me to set auto-updating tally sheets for my friend's business.

Am I able to make arrays of all buttons and shapes (i.e. radio buttons) and
perform this same type of check on them, too? How do I know what name to
call them (i.e. CheckBoxes, OptionButtons, others are...)?

Thanks to all,

Pflugs

"Tom Ogilvy" wrote:

Looks like you have checkboxes form the forms toolbar. I will assume the
names in your array are correct. It you get an error, that is the first
place to look.

Sub CheckBox1_Click()

Dim mycheckboxes As Variant
Dim box
mycheckboxes = Array("checkbox1", "check box 5", _
"check box 6", "check box 7")

Dim cost As Long
cost = 0

For Each box In mycheckboxes
If Activesheet.CheckBoxes(box).Value = xlOn Then
cost = cost + 1
End If
Next

Range("j7").Value = cost

End Sub

--
Regards,
Tom Ogilvy

"Pflugs" wrote in message
...
I am not able to access check boxes through macros. I searched the help
files and this forum, and I know that I am supposed to use something like
"CheckBox1", but it keeps telling me that "Object Required."

Here's my code:

Sub CheckBox1_Click()

Dim mycheckboxes As Variant
mycheckboxes = (Array("checkbox1", "check box 5", "check box 6", "check

box
7"))

Dim cost As Integer
cost = 0

For Each box In mycheckboxes
If box.Value = Checked Then
cost = cost + 1
End If
Next

Range("j7").Value = cost

End Sub

Thanks for the advice.






 
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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
How do I increase the size of check in check boxes Adams, Les Excel Discussion (Misc queries) 0 September 19th 06 02:35 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
How do i create a value for check boxes or option boxes Tim wr Excel Discussion (Misc queries) 1 February 9th 06 10:29 PM
Check Box influencing other Check Boxes iwrk4dedpr[_2_] Excel Programming 0 May 20th 04 12:55 AM


All times are GMT +1. The time now is 03:35 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"