Hide Columns with Dropdown Lists

Viewed 25

I am creating a form which has a dropdown for the user to select which platform their conference will be on. So the dropdown has two values, "Type1" and "Type2". Depending on which they choose, I would like the user to see the options for that specific value, from which they can choose to add. These options cells have a "true/false" checkbox. So if Type 1 is selected, I only want to see the rows where "Type 1" options are. And if Type 2 is selected, I only want to see "Type 2" options. I was able to get this to work with a formula for the sheet:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim TrigerCell As Range
Set Triggercell = Range("C29")
    If Not Application.Intersect(Triggercell, Target) Is Nothing Then
            If Triggercell.Value = "Type1" Then
    Rows("38:42").EntireRow.Hidden = True
    Rows("32:37").EntireRow.Hidden = False
            ElseIf Triggercell.Value = "Type2" Then
    Rows("32:37").EntireRow.Hidden = True
    Rows("38:42").EntireRow.Hidden = False
            End If
    End If
End Sub

The problem I have is even though those rows are hidden, all of the check boxes are stacking into one cell. So the cells are hiding, but the checkboxes in those cells are not. Is there some way to make the checkboxes "stick" in the cell so when the cell is hidden, so is the dropdown. I also noticed that if I copy a cell with a dropdown above it and paste it into a new cell, it copies and pastes the checkbox for that cell and the one above it. What am I missing?

0 Answers
Related