+ Reply to Thread
Results 1 to 4 of 4

Check all

Hybrid View

  1. #1
    Registered User
    Join Date
    01-15-2007
    Location
    US
    Posts
    23

    Check all

    Hello all,

    I have a spreadsheet that if I dont find anything wrong with a fire extinguisher I click yes. But there is 150 extinguishers with 4 colums, and that is a lot of clicking. Is there a way I can add a button for each colum that I can just click that button to put yes in all rows?

    Thank you for any help.

    Here is the form.
    Attached Files Attached Files

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Check all

    Perhaps if you only flag exceptions the form will be easier.
    I attached an edited version for you.

    Is that something you can work with?
    Attached Files Attached Files
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Check all

    Checkboxes are objects and although you have them arranged to display over a cell in a column, in reality they are not part of a cell. I mention this because you can't use VBA to loop down the rows in a column and set the checkbox just for a specific column - at least as far as I know.

    You would have to either process them all in one go or individually.
    This code will turn them all on, then you can deselect the exceptions.
    Sub Chkbox_On()
         
        Dim sChkbx As Shape
         
        For Each sChkbx In ActiveSheet.Shapes
            If sChkbx.Type = msoFormControl Then
                If sChkbx.FormControlType = xlCheckBox Then
                    If sChkbx.ControlFormat.Value = xlOff Then
                        sChkbx.ControlFormat.Value = xlOn
                    End If
                End If
            End If
        Next sChkbx
         
    End Sub

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Check all

    This seems to work. Add new checkboxes at the top of desired columns and make sure they are left-aligned with those below and assign this macro to them.
    Sub x()
    
    Dim ctl As Excel.CheckBox, ChkBox As CheckBox
    
    Application.ScreenUpdating = False
    
    Set ChkBox = ActiveSheet.CheckBoxes(Application.Caller)
        
    For Each ctl In ActiveSheet.CheckBoxes
        If ctl.Left = ChkBox.Left Then
            ctl.Value = ChkBox.Value
        End If
    Next ctl
    
    Application.ScreenUpdating = True
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1