Hide certain values in combobox

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
On my userform i have ComboBox4 with selections & also in Combobox 7 with selections.

ComboBox4 values are say 1,2,3,4
&
ComboBox7 values are say A,B,C,D,E,F

Is it possible that when ComboBox 1,2 or 4 is selected that ComboBox7 hides say A,B,C

Reason being that if a user selects say 3 he should only then be shown values in ComboBox7 that are relevant



Thanks
 

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.
Yes, it can be done, but it's not a matter of hiding items, but rather only filling them with the relevant items once an item in the first combobox is selected.
 
Upvote 0
Im trying to use just the 1 table which has all the values bnut was looking like something along the lines of
Rich (BB code):
If ComboBox4.Value = "A" Then
ComboBox7.value = "1".Visible = False
End If

Obviously written the correct way,just needed advice or a pointer
 
Upvote 0
I'm not at my computer at the moment, but quick question is this being used on a userform?
 
Upvote 0
How do you add the items to the combobar at present?
 
Upvote 0
Do you use any kind of VBA code? Or do you just speak out loud to Excel, saying "Properties box Table3 etc from a worksheet"?
 
Upvote 0
Is it possible that when ComboBox 1,2 or 4 is selected that ComboBox7 hides say A,B,C

The most practical, instead of hiding, is to show the relevant values.
I show you an example of how you can do it:

VBA Code:
Private Sub ComboBox4_Change()
  ComboBox7.Clear
  If ComboBox4.ListIndex = -1 Then Exit Sub
  
  Select Case ComboBox4.Value
    Case 1, 2, 4
      ComboBox7.List = Application.Transpose(Array("D", "E", "F"))  'Write here the relevant values that should be displayed
    Case 3
      ComboBox7.List = Application.Transpose(Array("A", "B", "C"))  'Write here the relevant values that should be displayed
  End Select
End Sub

Private Sub UserForm_Activate()
  'Load only combo 4 values
  ComboBox4.List = Application.Transpose(Array(1, 2, 3, 4))
End Sub

I hope it helps you.
 
Upvote 1
Solution

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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