ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FINDing data only in one column (https://www.excelbanter.com/excel-programming/294840-re-finding-data-only-one-column.html)

Tom Ogilvy

FINDing data only in one column
 
Range("A1").Select
Range("A:A").Find(What:=Worksheets("Front_End").Ra nge("C6").Value, _
After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False).Activate

Better would be

Dim rng as Range
Set rng =
Range("A:A").Find(What:=Worksheets("Front_End").Ra nge("C6").Value, _
After:=Range("A65536"), LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False)
if not rng is nothing then
rng.activate
else
msgbox "Not found"
exit sub
End if

--
Regards,
Tom Ogilvy



"Mr B" wrote in message
...
How can I use the Find command to have Excel saerch for a string but to

only look in the A column and not in any other column?

I'm currently using this statement:

Range("A1").Select
Cells.Find(What:=Worksheets("Front_End").Range("C6 ").Value,

After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,

MatchCase:= _
False).Activate

I'm not sure what searching byrows vs cybolumns does, but I really want it

to ONLY look in the A column and if it doesn't find it there, then to stop.

Thanks





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

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