Searching without activating

Giordano Bruno

Well-known Member
Joined
Jan 7, 2007
Messages
1,341
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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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
 
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

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
Back
Top