+ Reply to Thread
Results 1 to 2 of 2

Creating Dynamic Checkboxes

Hybrid View

  1. #1
    Registered User
    Join Date
    10-02-2012
    Location
    San Francisco, CA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Creating Dynamic Checkboxes

    I have a spreadsheet I'm working on where I'd like checkboxes to be able to "open" subsequent columns when checked-off. To give more information, I currently have Checkboxes in every row in "column C" and I would like them to reveal the hidden columns of D & E only for specific rows in which the check box has been marked off. Is that possible?

    I'd be open to using methods that don't include checkboxes if it's possible to achieve this in other ways.

    Thanks!

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

    Re: Creating Dynamic Checkboxes

    Try using Marlette check boxes.

    Code goes in the worksheet module. This is an example only, you will need to modify for row references, etc.

    Option Explicit
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        Dim lngCol As Long
        
        If Target.Cells.Count > 1 Then Exit Sub
        
        If Target.Column = 3 Then ' column c
        
            Select Case Target.Row
                Case 2: lngCol = 4
                Case 5: lngCol = 5
                Case Else: Exit Sub
            End Select
            
            Range("C" & Target.Row).Font.Name = "Marlette"
            
            If Range("C" & Target.Row).Value = vbNullString Then
                Range("C" & Target.Row).Value = "a"
            Else
                Range("C" & Target.Row).Value = vbNullString
            End If
            
            Columns(lngCol).EntireColumn.Hidden = Range("C" & Target.Row).Value <> "a"
            
        End If
    
    End Sub
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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