Stef6

New Member
Joined
Aug 1, 2018
Messages
15
I try to create a userform using Comboboxes, here the value of Box3 depends on the choice made in Box2. My code does not work. Someone a solution? Kind regards

Private SubUserForm_Initialize()
ComboBox1.List= Array("BIO", "LAN", "MAT", "Prodem")
ComboBox2.List = Array("klimaat","stoten")
1

IfComboBox2.Value = "klimaat" Then
ComboBox3.List= Array("ijsvorming", "ondergrond")
ElseIf ComboBox2.Value = "stoten"Then

ComboBox3.List =Array("ergonomie", "omgeving")

ElseIf ComboBox2.Value = "" ThenApplication.Wait (Now + TimeValue("0:00:10"))

GoTo 1

End If

End Sub

 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Put the code for populating ComboBox3 in the Change event of ComboBox2.
 
Upvote 0
Hi,
try this update to your code

Code:
Private Sub UserForm_Initialize()
    Me.ComboBox1.List = Array("BIO", "LAN", "MAT", "Prodem")
    Me.ComboBox2.List = Array("klimaat", "stoten")
End Sub


Private Sub ComboBox2_Change()
    Me.ComboBox3.List = _
    Choose(ComboBox2.ListIndex + 1, Array("ijsvorming", "ondergrond"), _
                                     Array("ergonomie", "omgeving"))
End Sub

Dave
 
Last edited:
Upvote 0
Thanks Dave, for some god reason this did not work yesterday.


Private Sub UserForm_Initialize()

Me.ComboBox1.List = Array("BIO", "CERT", "EnergyVille", "HKT", "INF", "MAN", "MAT", "MRG", "PRD", "SCT", "TAP")
Me.ComboBox2.List = Array("snijden/verwonden", "vallen/struikelen", "stoten", "klemmen/pletten", "verbranden", "elektriciteit", "werkhouding", "milieu/product / contact", "Andere")


End Sub

Private Sub ComboBox2_Change()

Me.ComboBox3.List = _
Choose(Array("glasbreuk", "gereedschap", "PBM falen", "constructie", "bewegende delen", "zichtbaarheid", "infrastuctuur"), _
ComboBox2.ListIndex + 1, Array("klimaat", "signalisatie", "belemmering doorgang", "constructie", "ergonomie", "morsen", "ontbrekende symbolen"), _
ComboBox2.ListIndex + 2, Array("signalisatie", "constructie", "ergonomie", "afval"), _
ComboBox2.ListIndex + 3, Array("constructie", "ergonomie", "afscherming", "verkeerd product"), _
ComboBox2.ListIndex + 4, Array("abnormale werking", "signalisatie", "afscherming"), _
ComboBox2.ListIndex + 5, Array("genaakbare delen", "sinalisatie", "communicatie"), _
ComboBox2.ListIndex + 6, Array("afstelling", "verlichting", "infrastructuur"), _
ComboBox2.ListIndex + 7, Array("verlies / lek", "vervallen product", "ontbreken beschrifting"), _
ComboBox2.ListIndex + 8, Array("verkeer", "communicatie 3den"))
End Sub
 
Upvote 0
Hi,
try this update

Code:
Private Sub UserForm_Initialize()


    Me.ComboBox1.List = Array("BIO", "CERT", "EnergyVille", "HKT", "INF", "MAN", "MAT", "MRG", "PRD", "SCT", "TAP")
    Me.ComboBox2.List = Array("snijden/verwonden", "vallen/struikelen", "stoten", "klemmen/pletten", _
                                "verbranden", "elektriciteit", "werkhouding", "milieu/product / contact", "Andere")




End Sub


Private Sub ComboBox2_Change()


    Me.ComboBox3.List = Choose(ComboBox2.ListIndex + 1, _
                        Array("glasbreuk", "gereedschap", "PBM falen", "constructie", "bewegende delen", "zichtbaarheid", "infrastuctuur"), _
                        Array("klimaat", "signalisatie", "belemmering doorgang", "constructie", "ergonomie", "morsen", "ontbrekende symbolen"), _
                        Array("signalisatie", "constructie", "ergonomie", "afval"), _
                        Array("constructie", "ergonomie", "afscherming", "verkeerd product"), _
                        Array("abnormale werking", "signalisatie", "afscherming"), _
                        Array("genaakbare delen", "sinalisatie", "communicatie"), _
                        Array("afstelling", "verlichting", "infrastructuur"), _
                        Array("verlies / lek", "vervallen product", "ontbreken beschrifting"), _
                        Array("verkeer", "communicatie 3den"))
End Sub

Dave
 
Upvote 0
Top!!!

I want to send the userform to colleagues by mail andcollect their answers in one file.
Can a userform be protected with a password so thatothers don’t have access?
In the userform are few comboboxes (CB's) and a button. Isthere a code so that when the button is pressed the values of the CB's are exportedto another xls (open file, insert new line, value CB1 to column A, CB2to B,etc)?
Thx
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,956
Members
449,200
Latest member
indiansth

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