ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find a string in one cells (https://www.excelbanter.com/excel-programming/404453-find-string-one-cells.html)

Souris

find a string in one cells
 
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,



Jim Cone

find a string in one cells
 
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,



Souris

find a string in one cells
 
Sheets("sheet1").Cells(7, 1).Find(MyString, , , xlPart)

I got type mismatch using abover code,

Thanks again,

"Jim Cone" wrote:

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,




Lazzzx

find a string in one cells
 
Hi,
Instr( cells(1,1).value, "searchstring" )
rgds,
Lazzzx

"Souris" skrev i meddelelsen
...
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,




Jim Cone

find a string in one cells
 

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,

"Jim Cone" wrote:

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,





All times are GMT +1. The time now is 02:20 PM.

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