ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filtering on String Length (https://www.excelbanter.com/excel-programming/397578-re-filtering-string-length.html)

Ron Coderre

Filtering on String Length
 
Perhaps something like this?:

Worksheets("Sheet1").Range("A1").AutoFilter _
field:=1, _
Criteria1:="????????", _
VisibleDropDown:=False

Does that help?
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


"Keith Wilby" wrote in message
...
What VBA code would I need to set a filter based upon string length in a
cell, for example, if I wanted to filter column A for those entries 8
characters in length?

I found this in the help:

Worksheets("Sheet1").Range("A1").AutoFilter _
field:=1, _
Criteria1:="Otis"
VisibleDropDown:=False

but I don't know how adapt that for my needs. I guess I need to use the
Len function somewhere in there.

A little background - I am creating and formatting the spreadsheet from
within MS Access.

Many thanks.
Keith.





All times are GMT +1. The time now is 02:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com