Multiple cell search

  • Thread starter spiz via OfficeKB.com
  • Start date
S

spiz via OfficeKB.com

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!
 
S

ShaneDevenshire

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.
 
S

spiz via OfficeKB.com

Beautiful! Thank you!
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!
 
Top