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.


A
B
C
D
E
F
G
H
I
1
Report#
Create
Include
Exclude
Name_Inc_1
Name_Inc_2
Name_Inc_3
Name_Exc_1
Name_Exc_2
2
Report_1
Yes
1
1
Name_11
Name_41
3
Report_2
No
1
0
Name_12
4
Report_3
Yes
2
0
Name_13
Name_21
5
Report_4
Yes
3
2
Name_14
Name_22
Name_31
Name_42
Name_51

<tbody>
</tbody>

- 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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,971
Messages
6,122,517
Members
449,088
Latest member
RandomExceller01

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