VBA Macro will copy/paste names to sheets

boilerup

New Member
Joined
Jul 17, 2019
Messages
4
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!
 

Forum statistics

Threads
1,085,589
Messages
5,384,624
Members
401,913
Latest member
chethan av

Some videos you may like

This Week's Hot Topics

Top