ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple Find/Search Criterias (https://www.excelbanter.com/excel-programming/343853-multiple-find-search-criterias.html)

swiftcode

Multiple Find/Search Criterias
 
Hi all,

I was wondering if there is anyway i simplify the following code to do
multiple search criterias.

On Error Resume Next

Cells.Find(What:="valdate", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Cells.Find(What:="invaldate", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

On Error Goto 0

Thanks in advance
Ray

Tushar Mehta

Multiple Find/Search Criterias
 
'*valdate' (w/o the quotes) will work in this specific instance.
However, AFAIK, there is no generic 'or' or 'and' capability within the
Find method.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Hi all,

I was wondering if there is anyway i simplify the following code to do
multiple search criterias.

On Error Resume Next

Cells.Find(What:="valdate", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Cells.Find(What:="invaldate", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

On Error Goto 0

Thanks in advance
Ray


swiftcode

Multiple Find/Search Criterias
 
Hi Tushar

Thank you for your tip, i guess i will

have to find a better way,

coz i am searching for multiple different

words and cannot just use a wildcard.

Have a good day.

Rgds
Ray


All times are GMT +1. The time now is 04:05 AM.

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