#1   Report Post  
Jeff
 
Posts: n/a
Default Cell.Find in VBA

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,


  #2   Report Post  
Frank Kabel
 
Posts: n/a
Default

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

--
Regards
Frank Kabel
Frankfurt, Germany

"Jeff" schrieb im Newsbeitrag
...
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,



  #3   Report Post  
Jeff
 
Posts: n/a
Default

I'm not sure I know how to do that.
Regards,


"Frank Kabel" wrote:

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

--
Regards
Frank Kabel
Frankfurt, Germany

"Jeff" schrieb im Newsbeitrag
...
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,




  #4   Report Post  
Ron de Bruin
 
Posts: n/a
Default

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 DataAutoFilter now to filter on 5

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jeff" wrote in message ...
I'm not sure I know how to do that.
Regards,


"Frank Kabel" wrote:

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

--
Regards
Frank Kabel
Frankfurt, Germany

"Jeff" schrieb im Newsbeitrag
...
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,






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"