Searching and Pulling from a Range VBA

HTMLGhozt

New Member
Joined
Jun 4, 2015
Messages
38
Hello,

I would say I'm relatively new to VBA in particular, and this site as well (it's my first post!).

I am working with Excel 2010.

I need help designing a macro to search a range (B, C in the case of the table below) and based on if a cell in the range has text (B1, B3, B5, B7, C1, C4, C5), for the macro to copy that cell and a cell from column A (A1 & B1, A1 & C1, A3 & B3, etc.) to paste into output in the order of column A then the other column.

[TABLE="class: grid, width: 700"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]Output[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]John Smith[/TD]
[TD]Not Paid[/TD]
[TD]Not in Payroll System[/TD]
[TD]John Smith Not Paid[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]James Smith[/TD]
[TD][/TD]
[TD][/TD]
[TD]John Smith Not in Payroll System[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Matthew Smith[/TD]
[TD]Not Paid[/TD]
[TD][/TD]
[TD]Matthew Smith Not Paid[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Michelle Pfeiffer[/TD]
[TD][/TD]
[TD]Is an actress[/TD]
[TD]Michelle Pfeiffer Is an actress[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]HTMLGhozt[/TD]
[TD]Not Paid[/TD]
[TD]Is me![/TD]
[TD]HTMLGhozt Not Paid[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Stacy Keibler[/TD]
[TD][/TD]
[TD][/TD]
[TD]HTMLGhozt Is me![/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Apples Galore[/TD]
[TD]Is Apples[/TD]
[TD][/TD]
[TD]Apples Galore Is Apples[/TD]
[/TR]
</tbody>[/TABLE]

If you have any questions please ask!
 
Last edited:
HTMLGhozt,

Thanks for the feedback.

You are very welcome. Glad I could help.

And, come back anytime.
 
Upvote 0

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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