Rest options available after listbox selection

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,689
Office Version
  1. 2007
Platform
  1. Windows
On my userform i select a value from ComboBox2
Its corresponding value is then shown in the way of an Option Button
Example of issue i see.
I select ListIndex1 value & then OptionButton 2 & 4 are visible which is correct.
BUT
If the user the decides he made the wrong ListBox selection & then selects ListIndex3 value OptionButton 5 & 6 are then shown BUT OptionButtion 2 & 4 are still also shown.
How can we somehow reset the OptioButton if the ListIndex selection are selected more than once

Thanks

I believe the code below is what you require

Rich (BB code):
    Private Sub ComboBox2_Change()
        ComboBox2 = UCase(ComboBox2)
        If ComboBox2.ListIndex = 0 Then
        OptionButton5.Visible = True
        OptionButton6.Visible = True
        Label8.Visible = True
        Label9.Visible = True
        End If
        If ComboBox2.ListIndex = 1 Then
        OptionButton2.Visible = True
        OptionButton4.Visible = True
        Label8.Visible = True
        Label9.Visible = True
        End If
        If ComboBox2.ListIndex = 2 Then
        OptionButton5.Visible = True
        OptionButton6.Visible = True
        Label8.Visible = True
        Label9.Visible = True
        End If
        End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Try

VBA Code:
Private Sub ComboBox2_Change()
        ComboBox2 = UCase(ComboBox2)
        If ComboBox2.ListIndex = 0 Then
        OptionButton5.Visible = True
        OptionButton6.Visible = True
        OptionButton2.Visible = False
        OptionButton4.Visible = False
         Label8.Visible = True
        Label9.Visible = True
        End If
        If ComboBox2.ListIndex = 1 Then
        OptionButton2.Visible = True
        OptionButton4.Visible = True
        Label8.Visible = True
        Label9.Visible = True
        End If
        If ComboBox2.ListIndex = 2 Then
        OptionButton5.Visible = True
        OptionButton6.Visible = True
        OptionButton5.Visible = False
        OptionButton6.Visible = False
        Label8.Visible = True
        Label9.Visible = True
        End If
        End Sub
 
Upvote 0
Same haapens
Example

In ListBox i select FRUIT
I then see APPLE & PEAR optionbuttons

I made a mistake so i select from ListBox again but this time CARS
I still see APPLE & PEAR but ALSO FORD & BMW

I am looking for when i make the selection again from the ListBox that APPLE & PEAR are not shown BUT just FORD & BMW

Thanks
 
Upvote 0
Sorry missed one option. Noticed that ListIndex 0 & 2 are the same

VBA Code:
Private Sub ComboBox2_Change()
        ComboBox2 = UCase(ComboBox2)
        If ComboBox2.ListIndex = 0 Then
        OptionButton5.Visible = True
        OptionButton6.Visible = True
        OptionButton2.Visible = False
        OptionButton4.Visible = False
         Label8.Visible = True
        Label9.Visible = True
        End If
        If ComboBox2.ListIndex = 1 Then
        OptionButton5.Visible = False
        OptionButton6.Visible = False
        OptionButton2.Visible = True
        OptionButton4.Visible = True
        Label8.Visible = True
        Label9.Visible = True
        End If
        If ComboBox2.ListIndex = 2 Then
        OptionButton5.Visible = True
        OptionButton6.Visible = True
        OptionButton2.Visible = False
        OptionButton4.Visible = False
        Label8.Visible = True
        Label9.Visible = True
        End If
        End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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