Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 86
Default Clear certain checkboxes

Is there a way to identify and clear only a certain subset of checkboxes on a
worksheet?

I've got the ActiveSheet.checkboxes.value = xlOff, but of course, that
clears all checkboxes.

So...just wanting to know.

Thank you for your time.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Clear certain checkboxes

If you know the names of the checkboxes, you could loop through all of them
looking for a match by name.

If you know the location/range of the checkboxes to be cleared, you could loop
through all of them and compare the .topleftcell of that checkbox with the
range.

How do you know which ones to clear?

Arlen wrote:

Is there a way to identify and clear only a certain subset of checkboxes on a
worksheet?

I've got the ActiveSheet.checkboxes.value = xlOff, but of course, that
clears all checkboxes.

So...just wanting to know.

Thank you for your time.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 86
Default Clear certain checkboxes

Dave,

Can I name just these 5 specific checkboxes through the Format Control menu?
If I can, then what does the macro look like which identifies the names of
those 5...

"Dave Peterson" wrote:

If you know the names of the checkboxes, you could loop through all of them
looking for a match by name.

If you know the location/range of the checkboxes to be cleared, you could loop
through all of them and compare the .topleftcell of that checkbox with the
range.

How do you know which ones to clear?

Arlen wrote:

Is there a way to identify and clear only a certain subset of checkboxes on a
worksheet?

I've got the ActiveSheet.checkboxes.value = xlOff, but of course, that
clears all checkboxes.

So...just wanting to know.

Thank you for your time.


--

Dave Peterson
.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Clear certain checkboxes

Select the textbox you want to name. (I just rightclick on it.)
Type the new name in the namebox -- to the left of the formulabar.

Type the new name and hit enter.

Then you could use:

activesheet.checkboxes("myCheckbox99").value = xloff
activesheet.checkboxes("CBX_SendEmail").value = xloff
activesheet.checkboxes("CBX_Whateveryouwant").valu e = xloff

(Remember that these are the checkboxes from the Forms toolbar -- not checkboxes
from the control toolbox toolbar -- but that matches your original code.)

Arlen wrote:

Dave,

Can I name just these 5 specific checkboxes through the Format Control menu?
If I can, then what does the macro look like which identifies the names of
those 5...

"Dave Peterson" wrote:

If you know the names of the checkboxes, you could loop through all of them
looking for a match by name.

If you know the location/range of the checkboxes to be cleared, you could loop
through all of them and compare the .topleftcell of that checkbox with the
range.

How do you know which ones to clear?

Arlen wrote:

Is there a way to identify and clear only a certain subset of checkboxes on a
worksheet?

I've got the ActiveSheet.checkboxes.value = xlOff, but of course, that
clears all checkboxes.

So...just wanting to know.

Thank you for your time.


--

Dave Peterson
.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Clear certain checkboxes

If you are using checkboxes from the Forms control bar, use

Dim N As Long
Dim V As Variant
V = Array("CheckBox1", "CheckBox3")
For N = LBound(V) To UBound(V)
ActiveSheet.CheckBoxes(V(N)).Value = False
Next N

List in the Array those checkboxes you want to clear.

If you are using checkboxes from the Controls (ActiveX) control bar,
use

Dim N As Long
Dim V As Variant
Dim WS As Worksheet
V = Array("cbx1", "cbx3")
For N = LBound(V) To UBound(V)
ActiveSheet.OLEObjects(V(N)).Object.Value = False
Next N

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com





On Thu, 20 May 2010 08:59:01 -0700, Arlen
wrote:

Is there a way to identify and clear only a certain subset of checkboxes on a
worksheet?

I've got the ActiveSheet.checkboxes.value = xlOff, but of course, that
clears all checkboxes.

So...just wanting to know.

Thank you for your time.

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
How to clear all checkboxes on a form? Arlen Excel Worksheet Functions 2 May 6th 10 04:20 PM
Macro to clear checkboxes Guy[_2_] Excel Worksheet Functions 5 January 2nd 09 08:39 PM
Macro to clear checkboxes and protected cells Guy[_2_] Excel Worksheet Functions 2 December 29th 08 08:54 PM
Clear Checkboxes fak119 Excel Discussion (Misc queries) 1 March 22nd 07 04:43 PM
Macro to make all checkboxes false and clear all comboxes ynissel Excel Discussion (Misc queries) 5 July 30th 05 12:22 AM


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