Searching without activating

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,298
I am trying to avoid using .Select or .Activate

Can I avoid them when searching for text in order to find the row number of the found text.

The active sheet will not be the sheet being searched.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

ravishankar

Well-known Member
Joined
Feb 23, 2006
Messages
3,566
Hi
try
=match(A1,Sheet2!B1:B100,0)
will search for text in A1 in col B of sheet2 and returns the row no. (to be precise, the position in the range specified, since it starts with 1, it will be same as row no.)
Ravi
 

tusharm

MrExcel MVP
Joined
May 28, 2002
Messages
11,029
It's good you are interested in avoiding selects and activates. For an example of how to use Find see
FindAll
http://www.tushar-mehta.com/excel/tips/findall.html

That page contains more than a simple example but hopefully you will be able to get the key ideas.
I am trying to avoid using .Select or .Activate

Can I avoid them when searching for text in order to find the row number of the found text.

The active sheet will not be the sheet being searched.
 

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,298
Thanks tusharm, Most interesting. In my case, the matching cell will all occur in a single column in contiguous rows and I need to find only the first row and the last row. I suspect that the Findall method is rather too elaborate for that.
 

Forum statistics

Threads
1,181,416
Messages
5,929,790
Members
436,693
Latest member
BroTr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top