ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find specific cell value (https://www.excelbanter.com/excel-programming/320618-find-specific-cell-value.html)

Nathan

Find specific cell value
 
Hello,

I have two cells. One cell contains the text "dollar pop". The other
contains the text "pop". I am attempting to use the "Find" method to find
the cell that contains "pop". However, it finds "dollar pop" (the location
of this cell is before "pop").

How can I find a cell that matches an exact text value ("pop"), not a cell
that contains the search text plus possibly other text in addition ("dollar
pop")?

Thank you.

Sharad Naik

Find specific cell value
 
..Find(What:="pop", LookAt:=xlWhole)

Sharad

"nathan" wrote in message
...
Hello,

I have two cells. One cell contains the text "dollar pop". The other
contains the text "pop". I am attempting to use the "Find" method to find
the cell that contains "pop". However, it finds "dollar pop" (the
location
of this cell is before "pop").

How can I find a cell that matches an exact text value ("pop"), not a cell
that contains the search text plus possibly other text in addition
("dollar
pop")?

Thank you.




Tom Ogilvy

Find specific cell value
 
Use the arguments to the find method. In this case the Lookat argument:
set rng = Cells.Find("pop", Lookin:=xlValues, _
.Lookat:=xlWhole, MatchCase:=False)

See excel vba help on the find method of the range object for details.

--
Regards,
Tom Ogilvy


"nathan" wrote in message
...
Hello,

I have two cells. One cell contains the text "dollar pop". The other
contains the text "pop". I am attempting to use the "Find" method to find
the cell that contains "pop". However, it finds "dollar pop" (the

location
of this cell is before "pop").

How can I find a cell that matches an exact text value ("pop"), not a cell
that contains the search text plus possibly other text in addition

("dollar
pop")?

Thank you.




Nathan

Find specific cell value
 
quite simple, thank you.

"Sharad Naik" wrote:

..Find(What:="pop", LookAt:=xlWhole)

Sharad

"nathan" wrote in message
...
Hello,

I have two cells. One cell contains the text "dollar pop". The other
contains the text "pop". I am attempting to use the "Find" method to find
the cell that contains "pop". However, it finds "dollar pop" (the
location
of this cell is before "pop").

How can I find a cell that matches an exact text value ("pop"), not a cell
that contains the search text plus possibly other text in addition
("dollar
pop")?

Thank you.






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

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