Combobox values based on combo values..... Based on a third combo box value?

Mr Parker

New Member
Joined
Mar 22, 2015
Messages
25
In a userform I am making I am trying to get to the choice of a third combobox value based on another two combo boxes.

Code:
 dim index as integer
index = combobox.listindex
combobox2.clear
combobox3.clear

select case index
     Case is = 0
          With combobox2
              .additem "blah 1"
              .additem "blah 2"
          End with
       Case is = 1
             With combobox2
               .additem "yep 1"
              .additem "yep 2"
        End with
end select

hooe I did the code thing correctly :)

anyhow. All that works a treat and have been wanting to add this combobox select thing into the forum as I had a heap of trouble finding a solution for it with layman terms. Hope that part can help someone in the future, at least.



but, now onto the issue I have. How would I go about populating a third combobox based on the other two combobox selections? Any help would be greatly appreciated.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Ok. So now I'm working through it some. and I'm puzzled.

Code:
private sub cbobx2_change()
dim index as integer
index = cbobox.listindex + cbox2.list index

cbobox3.clear

select case
 case is = 0,0
with cbobox3
     .additem "wee"
   End with
case is = 0,1
with cbobox3
.additem "wee2"
end with
end select
end sub

problem is. I select choice 1 from box 1 and choice 1 from box 2. Nothing
but, choice 1 and then choice 2 is giving me "wee" in box 3? Why?

the coding there isn't correct. it's just a general idea of things writing on my iPad. But I hope the main part of it is making some sort of sense.
 
Last edited:
Upvote 0
Code:
Private Sub CboMekArea_Change()
Dim index As Integer
index = CboMekArea.ListIndex

CboMekPart.Clear
CboMekFeil.Clear
    
    

Select Case index
    Case Is = 0
        With CboMekPart
           .AddItem "sdfsd"
            .AddItem "blah 2"
        End With
    Case Is = 1
        With CboMekPart
            .AddItem "yep 1"
            .AddItem "yep2"
        End With
    End Select
    
End Sub



Private Sub CboMekPart_Change()
Dim index As Integer
With Me.CBOProductType.Value = "pakkeri"

index = CboMekPart.ListIndex

CboMekFeil.Clear

Select Case index
     Case Is = 0
     
        With CboMekFeil
            .AddItem "weee"
            .AddItem "fskdjlkfj"
            .AddItem "jfsdkj"
        End With
    Case Is = 1
        With CboMekFeil
            .AddItem "weee2"
            .AddItem "dfsfs"
        End With
        
    End Select
    End With
End Sub

I have just put random things in the comboboxes, as it has no relevance to the coding.

however, if anyone has a better solution to this than this. then please could you let me know? thanks.

*edit* thought i had solved the issue, but further testing shows that i haven't. any solutions?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,217,415
Messages
6,136,506
Members
450,016
Latest member
murarj

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