View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Alok Alok is offline
external usenet poster
 
Posts: 318
Default Autofilter in a userform

Here is some code. Just add it to the userform.

Option Explicit

Private Sub ComboBox1_Click()
PopulateCombobox2
End Sub

Private Sub ComboBox2_Click()
PopulateCombobox3
End Sub

Private Sub UserForm_Initialize()

With ComboBox1
.AddItem "Simon"
.AddItem "Leon"
.ListIndex = 0
End With

End Sub
Private Sub PopulateCombobox2()
If ComboBox1.ListIndex = -1 Then
Exit Sub
End If
With ComboBox2
.Clear
If ComboBox1 = "Simon" Then
.AddItem "Flete"
.AddItem "Ildio"
ElseIf ComboBox1 = "Leon" Then
.AddItem "FSTR"
End If
.ListIndex = 0
End With
End Sub
Private Sub PopulateCombobox3()
If ComboBox2.ListIndex = -1 Then
Exit Sub
End If
With ComboBox3
.Clear
If ComboBox2 = "Flete" Then
.AddItem "1/4"
.AddItem "1"
ElseIf ComboBox2 = "Ildio" Then
.AddItem "1/2"
ElseIf ComboBox2 = "FSTR" Then
.AddItem "1/4"
End If
.ListIndex = 0
End With
End Sub


Alok


"filo666" wrote:

Hi, I'm tryng to make a userform whe
A B C D E
1 sIMON FLETE 1/4
2 SIMON ILDIO 1/2
3 SIMON FLETE 1
4
5 LEON FSTR 1/4
6 LEON FSFR 1/4

appears a kind of autofilter, I mean, if I select in combobox1 the SIMON
option then in combobox 2 appears just FLETE and ILDIO, if FLETE is selected
then appears in combobox3 1/4 and 1, and so on
Thanks in advance
ANY HELP WILL BE USEFULL