VBA Filter by Target Text

June 10, 2019 at 06:51:39
Specs: Windows
Is there an easy way to filter data with VBA and show only rows with target text?

I've added in an AutoFilter section to a VBA module and attached the module to a shape button. The button does show only the row I want to see, but it adds filter drop downs to each column and allows people to change filter. Is there an easy fix for this?

This may help create the code line. Code should:
1: Search Column D for target text "xyz"
2: Show all rows with target text found.
3: Hide all other rows where target text is not found.
4: Do not display a drop-down filter selection at the top of each column.


See More: VBA Filter by Target Text

Reply ↓  Report •

#1
June 10, 2019 at 08:19:50
re: "I've added in an AutoFilter section to a VBA module and attached the module to a shape button."

It would help if we started with you posting the code that you already have written. It might only need a bit of a tweak vs. having to write a completely different set of instructions from scratch.

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •

#2
June 10, 2019 at 08:38:07
Sub BillingAccess()
      
      Sheets("2019").Visible = True
      Sheets("2019").Activate
      Sheets("2019").Range("A1").AutoFilter Field:=4, Criteria1:="Biller"
      Columns("A").ColumnWidth = 10
      Columns("B").ColumnWidth = 20
      Columns("C").ColumnWidth = 42
      Columns("D").ColumnWidth = 31
      Columns("E").ColumnWidth = 10
      Columns("F").ColumnWidth = 10
      Columns("G").ColumnWidth = 15
      Columns("H").ColumnWidth = 10
      Columns("I").ColumnWidth = 13
      Columns("J").ColumnWidth = 10
      Columns("K").ColumnWidth = 16
      Columns("L").ColumnWidth = 16
      Columns("M").ColumnWidth = 10
      Columns("N").ColumnWidth = 10
      Columns("O").ColumnWidth = 10
      Columns("P").ColumnWidth = 53
      
End Sub


Reply ↓  Report •

#3
June 10, 2019 at 11:19:37
Sheets("2019").Columns(4).AutoFilter Field:=1, Criteria1:="Biller"


message edited by DerbyDad03


Reply ↓  Report •

Related Solutions

#4
June 10, 2019 at 11:57:24
Or, if you want no drop downs, even on Column D, try this:

Sheets("2019").Columns(4).AutoFilter Field:=1, _
               Criteria1:="Biller", Visibledropdown:=False

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code


Reply ↓  Report •

Ask Question