VBA Loop to Copy and Paste to Another Workbook

TheNewExcelGuy

New Member
Joined
Jun 13, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello everyone!

I'm looking for some help on how to go about making a code to Loop a file with 3 tabs and then copy, paste, and save another spreadsheet with the data. To be more specific I'm trying to do the 4 things below.

  1. I would like to have the code in an excel (called "Data") that will always have 3 tabs
    1. Company
    2. Contributions
    3. Employees
  2. I'm hoping the code can loop the list in the "Company" tab and for each row do the following:
    1. Open a Template called "Quote"
    2. Paste the value in column Data.Company.A1 to Quote.Sheet5.C13
    3. Paste the value in column Data.Company.B1 to Quote.Sheet5.C14
  3. Then move to the list in the "Contributions" tab and for the same company (something like Data.Company.B1 = Data.Contributions.A), do the following:
    1. Copy Contributions.C2:C6 to Quote.Sheet7.I22:I26
  4. And last, move to the list in the "Employees" tab and for the same company (something like Data.Company.B1 = Data.Employees.A), do the following:
    1. Copy all rows that match that company from Employees.C:M and paste it to Quote.Sheet5.A21:A
    2. Save the file as The value in Sheet5.C14 + Sheet5.C13 + the word Quote
Any help to get me on the right path would be greatly appreciated
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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