Cell.Find in VBA

G

Guest

Hi,
I have the following VBA Macro:
Set FoundCell = .Cells.Find(What:="199", _
After:=.Cells(1), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False)

I don't how to write a VBA macro that would cells.find all 5-digit numbers.
Here's an example:
Column A
199
199
75781
75899
199
80012
Thanks,
 
F

Frank Kabel

Hi
I think you have to loop through all cells and check the length/value
of each cell
 
R

Ron de Bruin

Hi Jeff

Check all cells in the sheet is not so fast

If your data is in one column you can use this

Add a column in your sheet and use this formula in the first cell and copy down
=LEN(A1)

Use Data>AutoFilter now to filter on 5
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top