+ Reply to Thread
Results 1 to 2 of 2

Excel 2007 : How to handle checkboxes dependency in Sheet1 to Sheet2

Hybrid View

S0004343680 How to handle checkboxes... 11-19-2011, 02:53 AM
foxguy Re: How to handle checkboxes... 11-19-2011, 04:41 AM
  1. #1
    Registered User
    Join Date
    11-19-2011
    Location
    hyderbad
    MS-Off Ver
    Excel 2007
    Posts
    1

    How to handle checkboxes dependency in Sheet1 to Sheet2

    Hi,

    i have my checkboxes in sheet 1, and i want to hide various columns if the checkbox is not selected in sheet 2. each checkbox is directly related to a column in sheet 2.

    With Regards,
    kalyan

  2. #2
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: How to handle checkboxes dependency in Sheet1 to Sheet2

    You will need to run a macro.
    I would put it in Worksheet_Activate for sheet2.

    I don't know how you decide if a checkbox is a checkbox that is attached to a column.
    I also don't know how you decide which column is attached to the checkbox.

    You can Name the checkboxes "ck_??" then check the name for "ck_*" and then extract the column # from the name.
    Or make a table somewhere that puts the checkbox names in a column and the column # in another column.

    Private Sub Worksheet_Activate()
        Dim ck as CheckBox
        For Each ck in Sheet1.CheckBoxes
            If <ck is a column checkbox> Then
                Me.Columns(<corresponding column #>).EntireColumn.Hidden = Not .Value
            End If
        Next ck
    End Sub
    Another option would be to assign a unique macro to each checkbox and in that macro you either hide or show the right correct column.

    Sub CheckBox1()
        Sheet2.Columns(1).EntireRow.Hidden = Not Sheet1.Checkboxes(1).Value
    End Sub
    
    Sub CheckBox2()
        Sheet2.Columns(2).EntireRow.Hidden = Not Sheet1.Checkboxes(2).Value
    End Sub
    
    Etc.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

+ 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