Home > Excel Tutorial > Filtering Via Userform

Filtering Via Userform

I used the userform has progress bar .Also, This template is example for progress bar .You can filter the columns by the UserForm.When you press the filter button ,opens progress bar.An advanced progress bar example.

progressbarinuserform

Click Here To Download Template

  1. bgutt1983@gmail.com
    May 1, 2016 at 7:09 pm

    Hi, I tried using your code but it is only copying over the data from row 1, so if I copy over 3 columns, it just has their headers on the “reports” page.. i just call the reports page in my code sheet2, the database is sheet1, CMD = command button.. etc… the references are right but the ranges are wrong.. I am not sure if it is the lines where you use baslangic_satiri because I have no idea what that mean…

    Private Sub ColumnArrange_Click()
    On Error Resume Next
    Sheet1.Unprotect
    Dim ws As Worksheet
    Dim ws2 As Worksheet
    Set ws = Sheets(“Sheet1”)
    Dim rng As Range
    Set rng = ws.Range(“$a$1”).CurrentRegion
    Sheets.Add.Name = “Sheet2”
    Set ws2 = Sheets(“Sheet2”)
    ws.ListObjects(“Data”).Unlist
    If LB2.ListCount = 0 Then
    MsgBox “You did not choose a filter field”
    Exit Sub
    End If
    ProgressDlg.Show
    For basliklar = 0 To LB2.ListCount – 1
    baslangic_satiri = 2
    ws2.Cells(baslangic_satiri – 1, basliklar + 1) = LB2.List(basliklar, 0)
    ws1.Cells(1, 1).CurrentRegion.Select.AdvancedFilter _
    Action:=xlFilterCopy, _
    CriteriaRange:=rng.Select, _
    CopyToRange:=ws2.Cells(baslangic_satiri – 1, basliklar + 1), _
    Unique:=False
    Next
    ws2.Columns.EntireColumn.AutoFit
    CMD6.Enabled = True
    End Sub

    Private Sub CMD2_Click()
    Unload Me
    End Sub

    Private Sub CMD4_Click()
    If LB2.Text = “” Then
    MsgBox “Please make a selection”
    End If
    If LB2.ListIndex > -1 Then
    LB1.AddItem LB2.Value
    LB2.RemoveItem (LB2.ListIndex)
    End If
    End Sub

    Private Sub CMD5_Click()
    If LB1.Text = “” Then
    MsgBox “Please make a selection”
    End If
    If LB1.ListIndex > -1 Then
    LB2.AddItem LB1.Value
    LB1.RemoveItem (LB1.ListIndex)
    End If
    End Sub

    Private Sub CMD6_Click()
    Sheets(“Sheet2”).Select
    Unload Me
    End Sub

    Private Sub LB2_Click()

    End Sub
    Private Sub UserForm_Initialize()

    LB1.AddItem (Sheet1.Range(“a1”))
    LB1.AddItem (Sheet1.Range(“b1”))
    LB1.AddItem (Sheet1.Range(“c1”))
    LB1.AddItem (Sheet1.Range(“d1”))
    LB1.AddItem (Sheet1.Range(“e1”))
    LB1.AddItem (Sheet1.Range(“f1”))
    LB1.AddItem (Sheet1.Range(“g1”))
    LB1.AddItem (Sheet1.Range(“h1”))
    LB1.AddItem (Sheet1.Range(“i1”))
    LB1.AddItem (Sheet1.Range(“j1”))
    LB1.AddItem (Sheet1.Range(“k1”))
    End Sub

    Sub Rando()
    Dim lc As Range
    Set lc = Cells.Find(“*”, [a1], , , xlByColumns, xlPrevious)
    Dim UniqueList() As String
    Dim X As Long
    Dim Rng1 As Range
    Dim c As Range
    Dim Unique As Boolean
    Dim Y As Long
    Dim lc As Long
    Set Rng1 = Sheets(“Sheet1”).Range(“Data(1)”)
    Y = 1
    ReDim UniqueList(1 To Rng1.Rows.Count)
    For Each c In Rng1
    If Not c.Value = vbNullString Then
    Unique = True
    For X = 1 To Y
    If UniqueList(X) = c.Text Then
    Unique = False
    End If
    Next
    If Unique Then
    Y = Y + 1
    Me.LB1.AddItem (c.Text)
    UniqueList(Y) = c.Text
    End If
    End If
    Next
    End Sub

    • netmerkez
      May 9, 2016 at 8:38 am

      Where is error ?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: