Search code help

jcaptchaos2

Well-known Member
Joined
Sep 24, 2002
Messages
1,032
Office Version
  1. 365
Platform
  1. Windows
I need some help in where a person could type a word or number in a cell say cell "A1" and then have it search a database in columns A:I and then put every row from the database that contains that word or number starting in "A3". So if I typed the word file in "A1" all the rows that contain the word file would populate starting in 'A3" I have been messing with this code that will only search column a and I can't figure out how to have it look at a cell anyway but this kinda does what I want but only pulls 1 line. Could someone steer me in the right direction.
Code:
Public Sub FindITEM()
  Dim aRange As Range
  
  Set aRange = Range("A1:i122").Find(what:="12105", LookAt:=xlWhole, LookIn:=xlValues)
    
  If aRange Is Nothing Then
    MsgBox "Data not found"
    Exit Sub
  Else
    aRange.Resize(1, 9).Copy Destination:=Range("N1")
  End If
End Sub
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Thanks for responding, I can do that and it will give me more lines of data but it does not do what I want. I also want to look at what is typed in a cell so instead of using Find(what:="12105", I want to use something like Find(what:=("A1"), but that does not seem to work. I would like it to look at the whole database and pull all rows that contain what ever I type in "A1"
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,551
Members
452,927
Latest member
rows and columns

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