Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default mulitple checkboxes - changing value of all of them at once

Hello,

I have mulitple checkbox controls (selected from the "control" toolbar) on
one worksheet. I would like to set the state of each checkbox to unchecked
all at once. I have figured out how to select all the checkboxes at one time
using:

ActiveSheet.OLEObjects.Select

But I cannot figure out how to change the value of all of them to "false".
I have tried, with no luck:

Selection.Value = false
Selection.oleobjects.Value = false
Selection.oleobjects.object.Value = false
etc
etc

Anyone how to do this?
Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default mulitple checkboxes - changing value of all of them at once

I think you have to loop through them set them to false one at a time:

Sub UnCheck()
Dim ob As OLEObject
For Each ob In ActiveSheet.OLEObjects
If TypeName(ob.Object) = "CheckBox" Then
ob.Object.Value = False
End If
Next ob
End Sub


Hope this helps
Rowan

"nathan" wrote:

Hello,

I have mulitple checkbox controls (selected from the "control" toolbar) on
one worksheet. I would like to set the state of each checkbox to unchecked
all at once. I have figured out how to select all the checkboxes at one time
using:

ActiveSheet.OLEObjects.Select

But I cannot figure out how to change the value of all of them to "false".
I have tried, with no luck:

Selection.Value = false
Selection.oleobjects.Value = false
Selection.oleobjects.object.Value = false
etc
etc

Anyone how to do this?
Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default mulitple checkboxes - changing value of all of them at once

Worked for me...
Requires a project reference to Microsoft Forms 2.0 object library.
'-----------------------
Sub TurnThemOff()
Dim objCB As OLEObject
For Each objCB In ActiveSheet.OLEObjects
If TypeOf objCB.Object Is MSForms.CheckBox Then
objCB.Object.Value = False
End If
Next
Set objCB = Nothing
End Sub
'---------------------------

Jim Cone
San Francisco, USA


"nathan" wrote in message
...
Hello,
I have mulitple checkbox controls (selected from the "control" toolbar) on
one worksheet. I would like to set the state of each checkbox to unchecked
all at once. I have figured out how to select all the checkboxes at one time
using:
ActiveSheet.OLEObjects.Select
But I cannot figure out how to change the value of all of them to "false".
I have tried, with no luck:
Selection.Value = false
Selection.oleobjects.Value = false
Selection.oleobjects.object.Value = false
etc
etc
Anyone how to do this?
Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default mulitple checkboxes - changing value of all of them at once

That works, thanks to both of you.

"Jim Cone" wrote:

Worked for me...
Requires a project reference to Microsoft Forms 2.0 object library.
'-----------------------
Sub TurnThemOff()
Dim objCB As OLEObject
For Each objCB In ActiveSheet.OLEObjects
If TypeOf objCB.Object Is MSForms.CheckBox Then
objCB.Object.Value = False
End If
Next
Set objCB = Nothing
End Sub
'---------------------------

Jim Cone
San Francisco, USA


"nathan" wrote in message
...
Hello,
I have mulitple checkbox controls (selected from the "control" toolbar) on
one worksheet. I would like to set the state of each checkbox to unchecked
all at once. I have figured out how to select all the checkboxes at one time
using:
ActiveSheet.OLEObjects.Select
But I cannot figure out how to change the value of all of them to "false".
I have tried, with no luck:
Selection.Value = false
Selection.oleobjects.Value = false
Selection.oleobjects.object.Value = false
etc
etc
Anyone how to do this?
Thanks.



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
Mulitple value lookup kritter286 Excel Worksheet Functions 5 April 20th 09 10:16 PM
Changing mulitple tab names RD Excel Worksheet Functions 4 May 3rd 07 03:23 PM
Mulitple formulas Joey041 Excel Discussion (Misc queries) 1 November 16th 06 02:48 AM
mulitple criteria imjustme Excel Discussion (Misc queries) 9 September 2nd 05 02:07 AM
Changes to Mulitple Worksheets Mac Landers Excel Worksheet Functions 3 January 26th 05 12:59 AM


All times are GMT +1. The time now is 09:56 AM.

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

About Us

"It's about Microsoft Excel"