find a string in one cells

  • Thread starter Thread starter Souris
  • Start date Start date
S

Souris

I want to find a special string like "Total" in some cells.

I tried to use find which is a methed of range, but it works only with value
and match which only works in the spreadsheet, but not VBA coding.


Are there any function that can find a sub string of the cell?

Your help is great appreciated,
 
From the help file for the Find method...
"expression.Find(What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte)"

For the "LookAt" argument specify "xlPart"
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Souris"
wrote in message
I want to find a special string like "Total" in some cells.

I tried to use find which is a methed of range, but it works only with value
and match which only works in the spreadsheet, but not VBA coding.

Are there any function that can find a sub string of the cell?
Your help is great appreciated,
 
Sheets("sheet1").Cells(7, 1).Find(MyString, , , xlPart)

I got type mismatch using abover code,

Thanks again,
 
Dim rngFound As Range
Set rngFound = Sheets("sheet1").Cells.Find(MyString, , , xlPart)
-or-
If you know the cell to look in use the code that Lazzzx provided.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins - check out "Find and List")



"Souris"
wrote in message
Sheets("sheet1").Cells(7, 1).Find(MyString, , , xlPart)

I got type mismatch using abover code,

Thanks again,
 

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

Back
Top