VBA Loop to go over a list and copy, paste, and save as

  • Hello everyone!


    I'm looking for some guidance 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 3 things.


    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
      4. Paste the value in column Data.Company.C1 to Quote.Sheet5.C15
      5. Paste the value in column Data.Company.D1 to Quote.Sheet5.C16
      6. Paste the value in column Data.Company.E1 to Quote.Sheet5.C17
    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
      2. Copy Contributions.D2:D6 to Quote.Sheet7.I27:I231
    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 in the right path would be greatly appreciated

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!