VBA code for three dependent comboboxes

kuhn

New Member
Joined
Oct 22, 2010
Messages
28
I've got a nice code for 2 dependent comboboxes(see below).
How do I get a third combobox (named subvraag2) to work as a dependent on the second one (subvraag)?

copying the code to the other subvraag_change event doesnt work.

Code:
Private Sub Hoofdvraag_Change()
   Dim strRange As String
    If Hoofdvraag.ListIndex > -1 Then
       strRange = Hoofdvraag
       Label7.Caption = strRange
       strRange = Replace(strRange, " ", "_")
       strRange = Replace(strRange, "/", "_")
       strRange = Replace(strRange, "'", "_")
            With subvraag
                .RowSource = vbNullString
                .RowSource = strRange
                .ListIndex = 0
            End With
    Else
       Label7.Caption = "Pas de question sécondaire // Geen secundaire vraag"
    End If
 

End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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