+ Reply to Thread
Results 1 to 5 of 5

Create loop, copy output, paste into new sheet

  1. #1
    Registered User
    Join Date
    05-23-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    3

    Create loop, copy output, paste into new sheet

    I'm new to VBA and looking for help with creating a macro.

    This is what I am trying to do:
    1 - Loop through values 1 to 1289 in cell $A$4 on Sheet1. Each of these values corresponds with a row of data and calculations are performed in my spreadsheet.
    2 - For each value above (1-1289), copy the output which is in row 2 of Sheet2.
    3 - Paste the output for each value from step 2 into Sheet3 starting with row 2 and ending with row 1290.

    Thank you for any help anyone can provide.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,001

    Re: Create loop, copy output, paste into new sheet

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    To add a file to a new post

    To add a file to an existing post.

  3. #3
    Registered User
    Join Date
    05-23-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    3

    Re: Create loop, copy output, paste into new sheet

    I tried to answer my question on my own with some research. I am pasting my current code below. I am having two problems:

    1) The program is pasting the output for i=1289 in all of the rows rather than the output for each integer 1 through 1289 in each row.
    2) It runs very slowly, which leads me to believe there is a better way to do this.

    Any advice will be much appreciated. If it is easier for someone to help if I upload my spreadsheet, I will do so this evening. Thanks in advance.


    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-19-2016
    Location
    London
    MS-Off Ver
    2007
    Posts
    26

    Re: Create loop, copy output, paste into new sheet

    Hello
    try this

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-23-2016
    Location
    New York
    MS-Off Ver
    2013
    Posts
    3

    Re: Create loop, copy output, paste into new sheet

    Works perfectly! Thank you so much, LOKLUK. This is extremely helpful.

+ 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. Copy paste from id to west column table data onto output sheet using vba
    By globalsourcing in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-13-2016, 02:13 PM
  2. [SOLVED] vba to copy data from rawdata and paste into output sheet depends upon code&child
    By johnmacpro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2016, 06:52 AM
  3. Replies: 3
    Last Post: 11-06-2014, 01:23 AM
  4. Macro to input value, copy output, paste it to another sheet
    By Settler7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 10:08 PM
  5. [SOLVED] Loop copy and paste in new sheet
    By tonnerre2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2012, 12:22 AM
  6. Need to create a button that can copy cells, create a new sheet and then paste there
    By torontoguy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-14-2009, 11:26 AM
  7. Loop Program to Copy/Paste from One Sheet to Another
    By smlaff01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2007, 11:33 AM

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