Excel Vba : Filtering Using Text Boxes

Posted by Kadr L.
4
Jul 30, 2017
108 Views

A nice filtering template.

The value in textbox is searched as part or whole in the column.

The results found are shown in the column, the other data are hidden.

A section of code:

Private Sub CommandButton2_Click()

Dim aCell As Range, bCell As Range

    Dim SearchString As String, son As Long

    Dim RngOne As Range, cell As Range

      On Error GoTo Whoa

If TextBox3.Value = Empty Then

MsgBox "Please, Enter A Value To Textbox", vbCritical, ""

Exit Sub

End If

    ActiveSheet.Range("A3:K3").AutoFilter

   Range("AN:AN").Clear

   Sheets("Data").Cells.EntireRow.Hidden = False

   SearchString = TextBox3.Value

   Range("F:F").Activate

Select Case TextBox3.Value

Case "?"

TextBox3.Value = "~?"

Case "*"

TextBox3.Value = "~*"

Case "%"

GoTo bura_a

Case "="

GoTo bura_a

Case IsNumeric(TextBox3)

GoTo bura_a

End Select

....


 Tutorial's video :https://youtu.be/Y92Kv356m0s


Source

Comments
avatar
Please sign in to add comment.