ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Multiple cell search (https://www.excelbanter.com/excel-discussion-misc-queries/190541-multiple-cell-search.html)

spiz via OfficeKB.com

Multiple cell search
 
Hi,
I would like to input search specifics into 3 blank cells.
then, a button would activate a search to find the 3 cells that match the
specified data from previously set data below in the respective columns.
If anyone can help, that'd be great.
Thank you!

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200806/1


ShaneDevenshire

Multiple cell search
 
Hi,

Suppose your 3 cells are A1:A3 and the range you want to search is B1:M100,
then a very simple routine to do this would be:

Sub mySearch()
x = Range("B1:M100").Find([a1]).Address
y = Range("B1:M100").Find([a2]).Address
z = Range("B1:M100").Find([a3]).Address
Range("" & x & "," & y & "," & z & "").Select
End Sub

There are many possible enhancements.
--
Cheers,
Shane Devenshire
Microsoft Excel MVP

"spiz via OfficeKB.com" wrote:

Hi,
I would like to input search specifics into 3 blank cells.
then, a button would activate a search to find the 3 cells that match the
specified data from previously set data below in the respective columns.
If anyone can help, that'd be great.
Thank you!

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200806/1



spiz via OfficeKB.com

Multiple cell search
 
Beautiful! Thank you!

ShaneDevenshire wrote:
Hi,

Suppose your 3 cells are A1:A3 and the range you want to search is B1:M100,
then a very simple routine to do this would be:

Sub mySearch()
x = Range("B1:M100").Find([a1]).Address
y = Range("B1:M100").Find([a2]).Address
z = Range("B1:M100").Find([a3]).Address
Range("" & x & "," & y & "," & z & "").Select
End Sub

There are many possible enhancements.
Hi,
I would like to input search specifics into 3 blank cells.
then, a button would activate a search to find the 3 cells that match the
specified data from previously set data below in the respective columns.
If anyone can help, that'd be great.
Thank you!


--
Message posted via http://www.officekb.com



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

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