VBA Macro will copy/paste names to sheets

boilerup

New Member
Joined
Jul 17, 2019
Messages
10
Hello everyone!

I have a VBA question on how to create a macro that will copy/paste names to specific worksheets if conditions are met.
I get new data each month so this will be very helpful for me if it's automated.
The data is 91 rows (90 reports) so this is just an example.
The idea is that I click each row whether it is "Yes" or "No" (column B) then click RUN Macro button.


[TABLE="width: 784"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Report#
[/TD]
[TD]Create
[/TD]
[TD]Include
[/TD]
[TD]Exclude
[/TD]
[TD]Name_Inc_1
[/TD]
[TD]Name_Inc_2
[/TD]
[TD]Name_Inc_3
[/TD]
[TD]Name_Exc_1
[/TD]
[TD]Name_Exc_2
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Report_1
[/TD]
[TD]Yes
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]Name_11
[/TD]
[TD][/TD]
[TD][/TD]
[TD]Name_41
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Report_2
[/TD]
[TD]No
[/TD]
[TD]1
[/TD]
[TD]0
[/TD]
[TD]Name_12
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Report_3
[/TD]
[TD]Yes
[/TD]
[TD]2
[/TD]
[TD]0
[/TD]
[TD]Name_13
[/TD]
[TD]Name_21
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]Report_4
[/TD]
[TD]Yes
[/TD]
[TD]3
[/TD]
[TD]2
[/TD]
[TD]Name_14
[/TD]
[TD]Name_22
[/TD]
[TD]Name_31
[/TD]
[TD]Name_42
[/TD]
[TD]Name_51
[/TD]
[/TR]
</tbody>[/TABLE]

- At B2, if Create column reads Yes then go to C2.
If C2 includes numeric value between 1-3 then copy/paste name from column Name_Inc_1 (for this instance, copy/paste Name_11) into cell A1 on worksheet Sheet_Inc_1.
At D2 (Exclude column), if numeric value is between 1-2 then copy/paste name from column Name_Exc_1 (for this instance, copy/paste Name_41) into cell A1 on
worksheet Sheet_Exc_1.
Save workbook to desktop as Report_1. Clear sheets then continue to next row...

- At B3, Create column reads No. Therefore, go to next row.
No saving workbook. No need to clear sheets (they are already cleared).

- At B4, if Create column reads Yes then go to C4. If C4 includes numeric value between 1-3 then copy/paste name from column Name_Inc_1 (for this instance, copy/paste Name_13) into cell A1 on worksheet Sheet_Inc_1.
Since B4's numeric value is 2, copy/paste twice. Copy/paste name from column Name_Inc_2 (Name_21) into cell A1 on worksheet Sheet_Inc_2.
Save workbook to desktop as Report_2. Clear sheets then continue to next row...

Reports 1-3 are completed. Macro should finish 90 reports.

Thanks for your help!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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