Find rows with a key value and return some values in a column

pedrosmr

New Member
Joined
Sep 6, 2011
Messages
1
Hey fellows!

This is my first topic in the forum. I hope you can help me, cause I'm a beginner on the VBA world. What I need to do is the following:

I have a worksheet like the one below:

<table border="0" cellpadding="0" cellspacing="0" width="280"><colgroup><col style="mso-width-source:userset;mso-width-alt:2560; width:53pt" span="4" width="70"> </colgroup><tbody><tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt;width:53pt" height="17" width="70">Column 1</td> <td class="xl24" style="width:53pt" width="70">Column 2</td> <td class="xl24" style="width:53pt" width="70">Column 3</td> <td class="xl24" style="width:53pt" width="70">Column 4</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">A1</td> <td class="xl24">AA11</td> <td class="xl24">AAA</td> <td class="xl24">A1111</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">A1</td> <td class="xl24">AA11</td> <td class="xl24">AAA</td> <td class="xl24">A1111</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">A1</td> <td class="xl24">AA11</td> <td class="xl24">AAA</td> <td class="xl24">A1111</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">B2</td> <td class="xl24">BB22</td> <td class="xl24">BBB</td> <td class="xl24">B2222</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">B2</td> <td class="xl24">BB22</td> <td class="xl24">BBB</td> <td class="xl24">B2222</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">B2</td> <td class="xl24">BB22</td> <td class="xl24">BBB</td> <td class="xl24">B2222</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">C3</td> <td class="xl24">CC33</td> <td class="xl24">CCC</td> <td class="xl24">C3333</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">C3</td> <td class="xl24">CC33</td> <td class="xl24">CCC</td> <td class="xl24">C3333</td> </tr> <tr style="height:12.75pt" height="17"> <td class="xl24" style="height:12.75pt" height="17">C3</td> <td class="xl24">CC33</td> <td class="xl24">CCC</td> <td class="xl24">C3333</td> </tr> </tbody></table>
And a want to make a macro that returns me something like this in other worksheet:

<table border="0" cellpadding="0" cellspacing="0" width="170"><colgroup><col style="mso-width-source:userset;mso-width-alt:3108; width:64pt" span="2" width="85"> </colgroup><tbody><tr style="height:12.75pt" height="17"> <td style="height:12.75pt;width:64pt" height="17" width="85">Search for</td> <td style="width:64pt" width="85">Results</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">A1</td> <td>AA11</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">B2</td> <td>AA11</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>AA11</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>AAA</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>AAA</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>AAA</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>A1111</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>A1111</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>A1111</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>BB22</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>BB22</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>BB22</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>BBB</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>BBB</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>BBB</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>B2222</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>B2222</td> </tr> <tr style="height:12.75pt" height="17"> <td style="height:12.75pt" height="17">
</td> <td>B2222</td> </tr> </tbody></table>
Can you help me on this?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,224,589
Messages
6,179,744
Members
452,940
Latest member
rootytrip

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