+ Reply to Thread
Results 1 to 3 of 3

Copying data from each iteration in a For Loop

  1. #1
    Registered User
    Join Date
    01-16-2018
    Location
    New South Wales
    MS-Off Ver
    2016 64-Bit
    Posts
    34

    Copying data from each iteration in a For Loop

    Hello,

    I have a script file that runs a simulation by using random data to forecast future values. I'm using a for loop to repeat this calculation around 100 times. Each iteration results in a column with 50 rows of data. I made a script to copy the results from the final iteration to another worksheet, however I need help with making a script copy the data from each iteration and place them in columns next to each other in a different worksheet.
    This is the script I use to copy the final iteration. It only copies the final iteration because it rewrites the last iteration on top of the previous iteration.

    Sheets("Loop").Range("K1:K50").Copy
    Sheets("Compilation").Activate
    Sheets("Compilation").Range("A1").PasteSpecial xlPasteValues


    Any help would be greatly appreciated.

    Thanks!

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Copying data from each iteration in a For Loop

    This is obviously "air code" since I don't have the workbook and full code to work with.
    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-16-2018
    Location
    New South Wales
    MS-Off Ver
    2016 64-Bit
    Posts
    34

    Re: Copying data from each iteration in a For Loop

    This works perfectly. Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. For Loop Iteration ?
    By distantkitty in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2017, 03:14 PM
  2. [SOLVED] How to move to next iteration of a Do Until loop
    By DannyJ in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-21-2017, 08:10 AM
  3. [SOLVED] My loop is missing last iteration
    By elmnas in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-22-2016, 06:46 PM
  4. [SOLVED] Go to next loop iteration if current loop has error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-03-2016, 09:54 PM
  5. VBA - How to continue inner loop while going to next iteration of outer loop?
    By alviniac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-14-2015, 11:21 PM
  6. jump to xth iteration of for next loop
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2015, 12:07 PM
  7. [SOLVED] Last Iteration of Loop?
    By saintplay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2015, 08:19 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1