Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy and move check box (check boxes) with new cell link? | Excel Worksheet Functions | |||
how to format a worksheet to tab through a series of check boxes? | Excel Worksheet Functions | |||
How do I delete an already created series of check boxes? | Excel Discussion (Misc queries) | |||
hiding data series with check/uncheck boxes | Charts and Charting in Excel | |||
Enable check box in protected sheet + group check boxes | Excel Discussion (Misc queries) |