ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding cells in a range (https://www.excelbanter.com/excel-programming/320762-finding-cells-range.html)

bob leathers

Finding cells in a range
 
I am trying to find cells only within a specific range such as b8:I164

The following works fine except it acts upon the whole spreadsheet and
changes cells (with my code) that I do not want changed

Cells.Find(What:=Range(myFind), After:=ActiveCell, LookIn:xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate

How do I limit the range that is searched?

Thanks

Bob

stanshoe

Finding cells in a range
 
Bob-

The first part of your code is defining the range you want to look in. The
"Cells" method without qualifiers returns all of the cells in the worksheet,
so "Cells.Find" means you are looking in all of the cells.

To limit the range you look at use something like
Range("B8:I164").Find(What=...

Stan Shoemaker
Palo Alto, CA

"Bob Leathers" wrote:

I am trying to find cells only within a specific range such as b8:I164

The following works fine except it acts upon the whole spreadsheet and
changes cells (with my code) that I do not want changed

Cells.Find(What:=Range(myFind), After:=ActiveCell, LookIn:xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate

How do I limit the range that is searched?

Thanks

Bob


Bob Phillips[_7_]

Finding cells in a range
 
Instead of Cells.Find use the specific range, such as Range("A1:H10").Find.
Cells is all cells in the worksheet.

--
HTH

-------

Bob Phillips
"Bob Leathers" wrote in message
...
I am trying to find cells only within a specific range such as b8:I164

The following works fine except it acts upon the whole spreadsheet and
changes cells (with my code) that I do not want changed

Cells.Find(What:=Range(myFind), After:=ActiveCell, LookIn:xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate

How do I limit the range that is searched?

Thanks

Bob




bob leathers

Finding cells in a range
 
Thanks for the help Folks. But this did not work.

I got the error message

Run-time error '1004':
Unable to get the Find property of the range class

with coding as follows Range("B8:I164").Find(What:=Range(myfind),.....

I did not mention that I am using Excel 97 SR2, could this be a feature
not available in 97?

Any other suggestions?

Thanks

Bob


In article ,
says...
Bob-

The first part of your code is defining the range you want to look in. The
"Cells" method without qualifiers returns all of the cells in the worksheet,
so "Cells.Find" means you are looking in all of the cells.

To limit the range you look at use something like
Range("B8:I164").Find(What=...



Stan Shoemaker
Palo Alto, CA

"Bob Leathers" wrote:

I am trying to find cells only within a specific range such as b8:I164

The following works fine except it acts upon the whole spreadsheet and
changes cells (with my code) that I do not want changed

Cells.Find(What:=Range(myFind), After:=ActiveCell, LookIn:xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).Activate

How do I limit the range that is searched?

Thanks

Bob




All times are GMT +1. The time now is 10:05 AM.

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