Hello all,
I am pretty new to VBA, but I am trying to resolve a little issue I am having. I have a web query pulling in and then I want to search the data for several terms and then copy the relative cell to the left as a variable in my code.
I have tried to use the find method, but I am having a problem with it finding the term within another cell, but not the one I want. EX. Search term: Price: Finds: List Price: I want: Price: How can I teach it to look for cells with and only with the search term in the cell?
In addition, I have about 20 terms I am looking for, If it can't find the exact term and nothing else, how do I teach it to do the next?
Thanks a ton!
Fellhouse
Hi FellHouse and welcome to the forum. Give the following code a trySub FindPrice() Dim oCell As Range Dim Ws1 As Worksheet Set Ws1 = Worksheets("Sheet1") Set oCell = Ws1.Cells.Find("Price", , xlValues, xlWhole) End Sub
Please leave a message after the beep!
or
andSub FindPrice() msgbox Sheets("Sheet1").Cells.Find("Price:", , xlValues, xlWhole).Address End Sub
Sub copy_FindPrice_leftcell_to_F1() Sheets("Sheet1").Cells.Find("Price:", , xlValues, xlWhole).offset(,-1).copy sheets("Sheet1").cells(1,6) End Sub
Last edited by snb; 10-02-2011 at 03:52 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks