Advance Filter vba

Av8tordude

Well-known Member
Joined
Oct 13, 2007
Messages
1,075
Office Version
  1. 2019
Platform
  1. Windows
When using the advance filter, it works fine, however, if I have words have similart starting letters (i.e. MS, MSFT or C, CVX, CVS...), it filters everthing. I would like to show only show data with the whole letters (i.e. if I want to see MS, show only MS, not MS, MSFT or C not CVS and CVX too). Can someone assist. Thanks

Code:
Rng.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("AT14:AV15"), Unique:=False
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Thank you Dave. Greatly appreciated.

On last question, can you help with a code that will display a msgbox to tell me the filter did not find any results? My Header starts at Row 14. Thank you
 
Upvote 0
you could try something like this

Code:
Dim VisibleRowCount As Long


Rng.AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("AT14:AV15"), Unique:=False


VisibleRowCount = Rng.Columns(1).SpecialCells(xlCellTypeVisible).Cells.Count - 1


If VisibleRowCount = 0 Then MsgBox "No Records Found", 48, "Not Found"

Dave
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top