Help with Find Function
Hello im new to excel VBA i come from a strong Access VBA backround here is
what im tring to do: Im Trying to search for something on another sheet and copy it over to the search sheet as the search results. For the search id like it to return anything that has for example the word "test" in it so if i put "Test" in the search box i want it to recongnize things like "Testing1", "initial Tests", "Test Name 1". ect.. if it has "test" anywhere in the cell i want it to return. this only dose exact maches. any idea how i can get it to do this? Now i was told about a find function im not sure how to implament it. i looked up the function and im a little confused on it. heres another help thread i posted it has the excel file. http://www.access-programmers.co.uk/...099#post805099 im using excel 2003 Code:
Sub clickSearch() if you can sift thrugh the mess here is where im having my problem: If Sheets("ImmageLocations").Cells(Row, Col) Like SearchFor Then the "Like" function is not the correct use here im told i need to use the find function. this code works but only exact matches. (even case) i need case not to be a issue. |
Help with Find Function
Look up Find and FindNext in VBA help, it will save the loops and you can do
part matches. -- __________________________________ HTH Bob "JBurlison" wrote in message ... Hello im new to excel VBA i come from a strong Access VBA backround here is what im tring to do: Im Trying to search for something on another sheet and copy it over to the search sheet as the search results. For the search id like it to return anything that has for example the word "test" in it so if i put "Test" in the search box i want it to recongnize things like "Testing1", "initial Tests", "Test Name 1". ect.. if it has "test" anywhere in the cell i want it to return. this only dose exact maches. any idea how i can get it to do this? Now i was told about a find function im not sure how to implament it. i looked up the function and im a little confused on it. heres another help thread i posted it has the excel file. http://www.access-programmers.co.uk/...099#post805099 im using excel 2003 Code:
Sub clickSearch() if you can sift thrugh the mess here is where im having my problem: If Sheets("ImmageLocations").Cells(Row, Col) Like SearchFor Then the "Like" function is not the correct use here im told i need to use the find function. this code works but only exact matches. (even case) i need case not to be a issue. |
Help with Find Function
oops kep giving me an errror while i was trying to post it i thought i lost
it all sorry for the multiple posts. can just use this one. |
Help with Find Function
It's not you, it is the forum. It has a problem.
-- __________________________________ HTH Bob "JBurlison" wrote in message ... oops kep giving me an errror while i was trying to post it i thought i lost it all sorry for the multiple posts. can just use this one. |
Help with Find Function
here is the example it gives
With Worksheets(1).Range("a1:a500") Set c = .Find(2, lookin:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Value = 5 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With Is "firstAddress = c.Address" relavent to the procedure? I dont understand how this function works. First your decalring the worksheet and the range of cells you wish to search in. Then you set "c" to find the number 2 (if not c is nothing) dose this mean if the number 2 is not found in the cell? firstAddress = c.Address (i dont understand this at all is the a variable "firstaddress" and "Address" or are they functions of some kind? i dont understand the purpose of this line.) "Do" (tating if the number 2 is found) c.value=5 (replaces with the number 5) Set c = .FindNext(c) (finds next) Loop While Not c Is Nothing And c.Address < firstAddress (lost here too) and if "c.Address" and "firstAddress" are variables what would they cells? whay im searching for? im just trying to figure out how to add this into my code. "Bob Phillips" wrote: Look up Find and FindNext in VBA help, it will save the loops and you can do part matches. -- __________________________________ HTH Bob "JBurlison" wrote in message ... Hello im new to excel VBA i come from a strong Access VBA backround here is what im tring to do: Im Trying to search for something on another sheet and copy it over to the search sheet as the search results. For the search id like it to return anything that has for example the word "test" in it so if i put "Test" in the search box i want it to recongnize things like "Testing1", "initial Tests", "Test Name 1". ect.. if it has "test" anywhere in the cell i want it to return. this only dose exact maches. any idea how i can get it to do this? Now i was told about a find function im not sure how to implament it. i looked up the function and im a little confused on it. heres another help thread i posted it has the excel file. http://www.access-programmers.co.uk/...099#post805099 im using excel 2003 Code:
Sub clickSearch() if you can sift thrugh the mess here is where im having my problem: If Sheets("ImmageLocations").Cells(Row, Col) Like SearchFor Then the "Like" function is not the correct use here im told i need to use the find function. this code works but only exact matches. (even case) i need case not to be a issue. |
All times are GMT +1. The time now is 09:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com