Excel button to choose

Asked

Viewed 438 times

0

I want to know if it is possible with buttons or list or with some formula. For example I have a list with name of countries (Portugal, Spain, Brazil) and I want in the other list just show me the capitals of these countries.

Example:

I choose a list or any other Spain I want that in the other list shows me the most important places.

 Espanha     -->    Madrid
                    Barcelona
                    Sevilha

And that I can select one of them

  • The link below can help you. It is possible to do without VBA with cascading drop-down list. https://www.youtube.com/watch?v=eVmfCMDc9-A

1 answer

2

good

Take a look at this code, see if it works:

    Private Sub UserForm_Initialize()
    ComboBox1.AddItem "Grains"
    ComboBox1.AddItem "Fruits"
    ComboBox1.AddItem "Dairy"
End Sub

Private Sub ComboBox1_Change()
    Application.EnableEvents = False
    ComboBox2.Clear
    Application.EnableEvents = True

    Select Case ComboBox1.Value
        Case "Grains"
            ComboBox2.AddItem "Cereals"
            ComboBox2.AddItem "Breads"
            ComboBox2.AddItem "Pastsa"
        Case "Fruits"
            ComboBox2.AddItem "Apples"
            ComboBox2.AddItem "Oranges"
            ComboBox2.AddItem "Pears"
        Case "Dairy"
            ComboBox2.AddItem "Cheese"
            ComboBox2.AddItem "Milk"
            ComboBox2.AddItem "Yogurt"
    End Select
End Sub

link: http://www.mrexcel.com/forum/excel-questions/578055-userform-combo-box-options-based-another-combo-box.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.