Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Series of check boxes

Hello. I have a list of files in column A that vba opens when the code is
executed. It opens all files listed. I would like to add a check box on
each row that will allow the user to choose which files to print.

I was thinking of using a check box from the forms menu, and having it
populate a column, then have vba loop through and pick all the "yes"'s from
that column. I know how to do that part. BUT, I was hoping for a button at
the top that was a "Select All", and "Deselect All". That part I don't know
how to do. Anyone have any idea on how to accomplish this, and if the
checkbox from the forms menu is the best way to go? Thank you in advance!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Series of check boxes


Steph,
Here is one approach...

'--------------------------------
'Determines the value of the first checkbox on the sheet.
'Sets all checkboxes to the opposite value.
'Uses a "Button" from the forms toolbar.
'The button is captioned "Toggle all CheckBoxes"
'Jim Cone - San Francisco, USA - August 29, 2005

Sub ToggleAll()
Dim Shp As Excel.Shape
For Each Shp In ActiveSheet.Shapes
If Shp.Type = msoFormControl Then
'from the Forms toolbar (not Activex)
If Shp.FormControlType = xlCheckBox Then
If Shp.ControlFormat.Value = 1 Then
Call SetButtonValuesOff
Else
Call SetButtonValuesOn
End If
Exit Sub 'important
End If
End If
Next 'Shp
Set Shp = Nothing
End Sub

'Changes the value of all checkboxes to 1 (checkmarked)
Sub SetButtonValuesOn()
Dim Shp As Excel.Shape
For Each Shp In ActiveSheet.Shapes
If Shp.Type = msoFormControl Then
'from the Forms toolbar (not Activex)
If Shp.FormControlType = xlCheckBox Then
Shp.ControlFormat.Value = 1
End If
End If
Next
Set Shp = Nothing
End Sub

'Changes the value of all checkboxes to 0 (Unchecked)
Sub SetButtonValuesOff()
Dim Shp As Excel.Shape
For Each Shp In ActiveSheet.Shapes
If Shp.Type = msoFormControl Then
'from the Forms toolbar (not Activex)
If Shp.FormControlType = xlCheckBox Then
Shp.ControlFormat.Value = 0
End If
End If
Next
Set Shp = Nothing
End Sub
'-----------------------


"Steph" wrote in message

Hello. I have a list of files in column A that vba opens when the code is
executed. It opens all files listed. I would like to add a check box on
each row that will allow the user to choose which files to print.

I was thinking of using a check box from the forms menu, and having it
populate a column, then have vba loop through and pick all the "yes"'s from
that column. I know how to do that part. BUT, I was hoping for a button at
the top that was a "Select All", and "Deselect All". That part I don't know
how to do. Anyone have any idea on how to accomplish this, and if the
checkbox from the forms menu is the best way to go? Thank you in advance!


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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
how to format a worksheet to tab through a series of check boxes? charvel Excel Worksheet Functions 0 April 21st 08 03:53 PM
How do I delete an already created series of check boxes? Tony Excel Discussion (Misc queries) 2 July 5th 07 09:52 PM
hiding data series with check/uncheck boxes BigSmile Mannequins Inc. Charts and Charting in Excel 1 November 11th 06 10:24 AM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM


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