ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Search using the words in a cell (https://www.excelbanter.com/excel-programming/349308-search-using-words-cell.html)

jj33002[_7_]

Search using the words in a cell
 

Is there any way to search using the words in a cell? The reason I need
to do that is because I have to enter in a lot of data and need to
search each word entered in each seperate cell and find it on a
different page.


--
jj33002
------------------------------------------------------------------------
jj33002's Profile: http://www.excelforum.com/member.php...o&userid=30020
View this thread: http://www.excelforum.com/showthread...hreadid=497369


Toppers

Search using the words in a cell
 
Hi,
Look at VBA FIND function. Code below is modified from VBA help.


HTH

With Worksheets(1).Range("a1:a500") ' Search A1 to A500 in Worksheets(1)

MyWord=Range("c1") ' <== change for your Cell(s)

Set c = .Find(MyWord, lookin:=xlValues)
If Not c Is Nothing Then ' MyWord found .....
firstAddress = c.Address
Do
..... add your code
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress 'Keep
searching until all found
End If
End With


"jj33002" wrote:


Is there any way to search using the words in a cell? The reason I need
to do that is because I have to enter in a lot of data and need to
search each word entered in each seperate cell and find it on a
different page.


--
jj33002
------------------------------------------------------------------------
jj33002's Profile: http://www.excelforum.com/member.php...o&userid=30020
View this thread: http://www.excelforum.com/showthread...hreadid=497369



Tom Ogilvy

Search using the words in a cell
 
for each cell in selection
With Worksheets("Other").Cells
set rng = .Find(What:=cell.Value, _
After:=.Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
End With
if not rng is nothing then
msgbox cell.Value & " found at " _
& rng.Address(0,0,xlA1,True)
else
msgbox cell.Value & " not found"
end if
Next

--
Regards,
Tom Ogilvy


"jj33002" wrote in
message ...

Is there any way to search using the words in a cell? The reason I need
to do that is because I have to enter in a lot of data and need to
search each word entered in each seperate cell and find it on a
different page.


--
jj33002
------------------------------------------------------------------------
jj33002's Profile:

http://www.excelforum.com/member.php...o&userid=30020
View this thread: http://www.excelforum.com/showthread...hreadid=497369




jj33002[_8_]

Search using the words in a cell
 

Hello,

I appreciate the help I used the code that Tom provided and it does
what I wanted it to. The only thing is that instead of a message box
of where the cell is found, is there any way to just select that cell?


--
jj33002
------------------------------------------------------------------------
jj33002's Profile: http://www.excelforum.com/member.php...o&userid=30020
View this thread: http://www.excelforum.com/showthread...hreadid=497369



All times are GMT +1. The time now is 02:14 AM.

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