ExcelBanter

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

Tom Ogilvy

Filtering on String Length
 
in an adjacent column, but in the formula

M2: =len(B2)

Range("M2:M200").Formula = "=Len(B2)"

then apply your filter to column M.

--
Regards,
Tom Ogilvy


"Keith Wilby" wrote:

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.



Keith Wilby

Filtering on String Length
 
"Tom Ogilvy" wrote in message
...
in an adjacent column, but in the formula

M2: =len(B2)

Range("M2:M200").Formula = "=Len(B2)"

then apply your filter to column M.


Spot on, working a treat. Thanks Tom.

Keith.



All times are GMT +1. The time now is 10:28 AM.

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