+ Reply to Thread
Results 1 to 6 of 6

Autofilter in a userform

  1. #1
    filo666
    Guest

    Autofilter in a userform

    Hi, I'm tryng to make a userform where:
    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

  2. #2
    Norman Jones
    Guest

    Re: Autofilter in a userform

    Hi Filo666,

    See xlDynamic's page on Dependendent Dropdowns:

    http://www.xldynamic.com/source/xld.Dropdowns.html


    ---
    Regards,
    Norman


    "filo666" <filo666@discussions.microsoft.com> wrote in message
    news:9B8D9066-C2AA-4942-91FF-22E720A3BA7E@microsoft.com...
    > Hi, I'm tryng to make a userform where:
    > 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




  3. #3
    Alok
    Guest

    RE: 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 where:
    > 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


  4. #4
    filo666
    Guest

    Re: Autofilter in a userform

    thankd norman, I'll chek the internet page and I'll answer you
    Alok: I have 2000 rows and 3 columns, could you tell me with this conditions
    please¡

    "Norman Jones" wrote:

    > Hi Filo666,
    >
    > See xlDynamic's page on Dependendent Dropdowns:
    >
    > http://www.xldynamic.com/source/xld.Dropdowns.html
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    > "filo666" <filo666@discussions.microsoft.com> wrote in message
    > news:9B8D9066-C2AA-4942-91FF-22E720A3BA7E@microsoft.com...
    > > Hi, I'm tryng to make a userform where:
    > > 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

    >
    >
    >


  5. #5
    filo666
    Guest

    Re: Autofilter in a userform

    Norman: What I need it's a little bit more complex, the values of combobox1
    are in the "ActiveSheet.Range("A3", Range("A65535").End(xlUp)).Cells.Value"
    (means from a3 to the last value of the sheet); combobox2
    "ActiveSheet.Range("B3", Range("B65535").End(xlUp)).Cells.Value" and
    combobox3 ActiveSheet.Range("C3", Range("C65535").End(xlUp)).Cells.Value"
    I start making a macro to get the values of the column A (I mean, as in
    column A there are a lot of values aprx 2000 and among this 2000 there are a
    lot of values that are equals, as well as the "" values) and it works fine,
    this macro could be used to obtain values to combobox 2 and 3, but, HOW TO
    MAKE THE RALITIONS AMONG THE TREE OF THEM?????
    TKS
    "Norman Jones" wrote:

    > Hi Filo666,
    >
    > See xlDynamic's page on Dependendent Dropdowns:
    >
    > http://www.xldynamic.com/source/xld.Dropdowns.html
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    > "filo666" <filo666@discussions.microsoft.com> wrote in message
    > news:9B8D9066-C2AA-4942-91FF-22E720A3BA7E@microsoft.com...
    > > Hi, I'm tryng to make a userform where:
    > > 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

    >
    >
    >


  6. #6
    Alok
    Guest

    Re: Autofilter in a userform

    Hi try the following.
    Past the following in the Form's code module

    Option Explicit
    Dim col As New Collection
    Dim cola As New Collection
    Dim colb As New Collection
    Dim colc As New Collection

    Private Sub ComboBox1_Click()
    PopulateCombobox2
    End Sub

    Private Sub ComboBox2_Click()
    PopulateCombobox3
    End Sub

    Private Sub UserForm_Initialize()
    Dim i%

    PopulateCollections
    With ComboBox1
    For i = 1 To cola.Count
    .AddItem cola.Item(i)
    Next i
    .ListIndex = 0
    End With

    End Sub
    Private Sub PopulateCombobox2()
    Dim i%
    Dim oC As Class1
    If ComboBox1.ListIndex = -1 Then
    Exit Sub
    End If

    Set colb = New Collection
    For i = 1 To col.Count
    Set oC = col.Item(i)
    If oC.a = ComboBox1 Then
    On Error Resume Next
    colb.Add Item:=oC.b, Key:=oC.b
    On Error GoTo 0
    End If
    Next i
    With ComboBox2
    .Clear
    For i = 1 To colb.Count
    .AddItem colb.Item(i)
    Next i
    If .ListCount > 0 Then
    .ListIndex = 0
    End If
    End With
    End Sub
    Private Sub PopulateCombobox3()
    Dim i%
    Dim oC As Class1
    If ComboBox1.ListIndex = -1 Or ComboBox2.ListIndex = -1 Then
    Exit Sub
    End If

    Set colc = New Collection
    For i = 1 To col.Count
    Set oC = col.Item(i)
    If oC.a = ComboBox1 And oC.b = ComboBox2 Then
    On Error Resume Next
    colc.Add Item:=oC.c, Key:=oC.c
    On Error GoTo 0
    End If
    Next i
    With ComboBox3
    .Clear
    For i = 1 To colc.Count
    .AddItem colc.Item(i)
    Next i
    If .ListCount > 0 Then
    .ListIndex = 0
    End If
    End With
    End Sub

    Private Sub PopulateCollections()
    Dim sKey$
    Dim r&
    Dim oC As Class1
    Dim a$, b$, c$

    With Sheet1
    For r = 1 To .UsedRange.Rows.Count
    a = .Cells(r, 1).Value
    b = .Cells(r, 2).Value
    c = .Cells(r, 3).Value
    If a <> "" And b <> "" And c <> "" Then
    On Error Resume Next
    Set oC = New Class1
    oC.a = a
    oC.b = b
    oC.c = c
    col.Add Item:=oC, Key:=a & b & c

    cola.Add Item:=a, Key:=a

    On Error GoTo 0
    End If
    Next r
    End With

    End Sub
    '=============================================

    Post the following in a Class module called Class1

    Option Explicit

    Public a As String
    Public b As String
    Public c As String
    '=========================================

    Alok



    "filo666" wrote:

    > Norman: What I need it's a little bit more complex, the values of combobox1
    > are in the "ActiveSheet.Range("A3", Range("A65535").End(xlUp)).Cells.Value"
    > (means from a3 to the last value of the sheet); combobox2
    > "ActiveSheet.Range("B3", Range("B65535").End(xlUp)).Cells.Value" and
    > combobox3 ActiveSheet.Range("C3", Range("C65535").End(xlUp)).Cells.Value"
    > I start making a macro to get the values of the column A (I mean, as in
    > column A there are a lot of values aprx 2000 and among this 2000 there are a
    > lot of values that are equals, as well as the "" values) and it works fine,
    > this macro could be used to obtain values to combobox 2 and 3, but, HOW TO
    > MAKE THE RALITIONS AMONG THE TREE OF THEM?????
    > TKS
    > "Norman Jones" wrote:
    >
    > > Hi Filo666,
    > >
    > > See xlDynamic's page on Dependendent Dropdowns:
    > >
    > > http://www.xldynamic.com/source/xld.Dropdowns.html
    > >
    > >
    > > ---
    > > Regards,
    > > Norman
    > >
    > >
    > > "filo666" <filo666@discussions.microsoft.com> wrote in message
    > > news:9B8D9066-C2AA-4942-91FF-22E720A3BA7E@microsoft.com...
    > > > Hi, I'm tryng to make a userform where:
    > > > 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

    > >
    > >
    > >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1