Read a cell from column B, Find it in Column A, Write that row out to a new sheet:

humerick

New Member
Joined
Oct 8, 2009
Messages
6
I need to be able to read from a column on one sheet(A), find that data on another sheet(B), write that row out to sheet(A) that matched the search. I know this might sound confusing, so I will try to illustrate it below.

You will always be reading from Col B on Sheet A, finding the match in Row A on Sheet B, writing the row out back on Sheet A, then reading Col B on Sheet A from the new row that you just wrote.

(Beginning)
Sheet A
AB
1Cat
2
3
4

<tbody>
</tbody>


Sheet B
AB
1CatDog
2RatMouse
3DogFrog
4MouseCat
5FrogRat

<tbody>
</tbody>


Final
Sheet A
AB
1Cat
2CatDog
3DogFrog
4FrogRat
5RatMouse
6MouseCat

<tbody>
</tbody>



The final pattern that I should end up with on Sheet A is: Whatever is in Column B, then Column A should start with on the next row. I hope this makes sense!
Thank you very much in advance in any help that you can give me on this.
Note: I could start out with Sheet A being blank if I could somehow feed/start the whole process out by getting the first search term (Cat in this example) from somewhere (input)
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
How about
Code:
Sub chk()

   Dim Fnd As Range
   Dim Wrd As String
   Dim Ws As Worksheet
   
   Set Ws = Sheets("[COLOR=#ff0000]Sheet3[/COLOR]")
   With Sheets("[COLOR=#ff0000]Ranking[/COLOR]")
      Wrd = .Range("B" & Rows.Count).End(xlUp).Value
      Do
         Set Fnd = Ws.Columns(1).Find(Wrd, , , xlWhole, , , True, , False)
         If Fnd Is Nothing Then Exit Sub
         .Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(, 2).Value = Fnd.Resize(, 2).Value
         Wrd = .Range("B" & Rows.Count).End(xlUp).Value
      Loop Until Wrd = .Range("B1").Value
   End With
End Sub
Change sheet names in red to suit.
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

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