ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using vba find (https://www.excelbanter.com/excel-programming/442119-using-vba-find.html)

simonc

Using vba find
 
I couldn't understand why the find method wasn't working in a macro until I
realised that the range of cells I was searching didn't contain actual text,
but the result of formulae referring to text in another worksheet.

Is there a way of using find so that it will identify if the result of a
formula matches the text you're searching for?

Grateful for advice.

joel[_954_]

Using vba find
 

Set SearchRange = Sheets("sheet1").Range("A1:A100")
set c = SearchRange(what:="ABC", lookin:=xlvalues,lookat:=xlwhole)
if c is nothing then
msgbox("Nothing found")
else
msgbox("Found at : " & c.address(external:=true))
end if


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=199159

http://www.thecodecage.com/forumz



All times are GMT +1. The time now is 08:06 AM.

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