Create Dependent Check Box Selection

Dokat

Active Member
Joined
Jan 19, 2015
Messages
304
Office Version
  1. 365
Hi,

Is it possible to create dependent check box and populate new list with check boxes based on prior selection? I know this can be done with drop down list however I will need to have multiple selection therefor dropdown is not an option. This can be done with PowerApps however I don't have access.

In below example user needs to be able to select Fruit and Vegetable or Vegetable and Meat with checkboxes to populate only corresponding results with check box. Is this possible, appreciate anyone's help.

FruitApple
FruitBanana
FruitStrawberry
VegetableLettuce
VegetableEggplant
VegetablePepper
MeatBeef
MeatChicken Pork
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Are you talking about checkbox on a userform?
I suggest, instead of checkbox, you use 2 listbox. A listbox has multi-select functionality.
 
Upvote 0
Are you talking about checkbox on a userform?
I suggest, instead of checkbox, you use 2 listbox. A listbox has multi-select functionality.
Thank you for your reply and recommendation. I assigned the below code to the checkbox and it worked.


VBA Code:
Sub UpdateList()
    Dim ws As Worksheet
    Dim lookupRange As Range, cell As Range
    Dim outputRow As Integer

    ' Set the worksheet
    Set ws = ThisWorkbook.Sheets("Calculator")

    ' Clear column D from row 7 onwards
    ws.Range("D7:D" & ws.Cells(ws.Rows.Count, "D").End(xlUp).Row).ClearContents

    ' Set the lookup range
    Set lookupRange = ws.Range("AK2:AK108")

    ' Initialize the output row
    outputRow = 7 ' Starting from row 7 (cell D7)

    ' Loop through each cell in the lookup range
    For Each cell In lookupRange
        ' If the cell value is TRUE (checkbox is checked), copy the corresponding value from column AB
        If cell.Value = True Then
            ws.Cells(outputRow, "D").Value = ws.Cells(cell.Row, "AJ").Value
            outputRow = outputRow + 1 ' Move to the next row
        End If
    Next cell
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,202
Messages
6,123,625
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top