VBA macro will copy/paste if conditions are met

Status
Not open for further replies.

boilerup

New Member
Joined
Jul 17, 2019
Messages
10
I have a VBA question on how to create a macro that will copy/paste names to specific worksheets if conditions are met. A few examples below of how the code should run through the sheet...

  • B12 is Yes. Include is 1. Exclude is 0. Therefore, copy/paste NameG1 to cell A1 of Name_Inc_1. Save workbook to desktop as Report1 (column D). Clear A1 from all tabs (besides Setup tab) then move to next row.
  • B13 is Yes. Include is 2; Exclude is 1. Therefore, copy/paste NameG2 to cell A1 of Name_Inc_1. Also, copy/paste NameH1to cell A1 of Name_Inc_2 (because include tab is 2). Copy/paste NameM1 to cell A1 of Name_Exc_1. Save workbook to desktop as Report2 (column D). Clear A1 from all tabs (besides Setup tab) then move to next row.
  • B14 is No. Move to next row. No need to save workbook or clear tab (already cleared).
The code I attempted is messy and not helpful (I have just started learning VBA). Googling things isn't helping me too much right now. I know I would use code such as IF, ELSE, THEN, LOOP but I am just getting confused.
YPMnl.png
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Duplicate https://www.mrexcel.com/forum/excel...ste-names-sheets-post5313437.html#post5313437

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

If you do not receive a response, you can "bump" it by replying to it again, though we advise you to wait 24 hours before doing and not to bump a thread more than once a day.

 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,072
Latest member
DW Draft

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