+ Reply to Thread
Results 1 to 11 of 11

VBA Looping for copy paste after running analysis

  1. #1
    Registered User
    Join Date
    04-13-2014
    Location
    Vancouver, WA
    MS-Off Ver
    Excel 2007
    Posts
    5

    VBA Looping for copy paste after running analysis

    Hello,

    I need some help with the following VBA. I was unable to get a loop to reliably run my analysis, and thought it may be easier for someone to look at the steps I need repeated. I have locked in specific cells that cannot change, and anything unlocked will need to copy/paste from the row below. I will need this to continue this loop until the dates from the Range B8-B1500 end (Output Tab). Thanks for your help--see below.

    Please Login or Register  to view this content.
    Last edited by Fotis1991; 04-14-2014 at 10:06 AM. Reason: You need to add code tags to every post!

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Looping for copy paste after running analysis

    Hi finansator,

    Welcome to the Forum

    Have I isolated the loop with my red shading?

    Please Login or Register  to view this content.
    BTW - just highlight your code and click on the pound sign
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    04-13-2014
    Location
    Vancouver, WA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA Looping for copy paste after running analysis

    Thanks for your help with this, xladept!

    To answer your question, no. I will need it to continue copying and pasting results from changes to the following:

    wo.Range("B8").Copy: wa.Range("C10").PasteSpecial Paste:=xlPasteValues

    B8:B1500 is where my dates are stored. The loop will need to copy the date from the "output" tab, paste it into the "Analysis" tab. An analysis will then run--updating the cells to be copied (these cells won't change), and then will paste the outputted values to the rows in the output tab. As the dates change, so to the outputs on the "analysis" tab. then I will be storing the output values (by date) on the output tab. this will repeat until the the last date is defined in the "output" tab. All of the following will need to be looped.

    Please Login or Register  to view this content.
    Last edited by Fotis1991; 04-14-2014 at 10:06 AM.

  4. #4
    Registered User
    Join Date
    04-13-2014
    Location
    Vancouver, WA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA Looping for copy paste after running analysis

    Thanks for pointing that out, Fotis1991. My bad, indeed.

    Everything highlighted will be repeated. However, the cells highlighted in blue will stay the same while the others will need to be filled row by row until the last date from the output worksheet range B8:B1500 has been copied, and the results pasted.

    Please Login or Register  to view this content.
    Last edited by finansator; 04-14-2014 at 10:01 AM. Reason: clarification

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Looping for copy paste after running analysis

    Hi Finansator,

    Best that you:

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

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

    View Pic

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Looping for copy paste after running analysis

    Hi Finansator,

    Thanks for the rep

    Best that you:

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

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

    View Pic

  7. #7
    Registered User
    Join Date
    04-13-2014
    Location
    Vancouver, WA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA Looping for copy paste after running analysis

    Attached is a very basic example that I put together. I have left some instructions within the workbook. I also put your macro into the workbook to test it. It worked great, but needs to be repeated for the rest of the dates.

    Thanks again!


    Example Workbook.xlsm

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Looping for copy paste after running analysis

    Hi Finansator,

    Try this - the looping works, but it's slow and I'm not sure it's what you wanted:

    Please Login or Register  to view this content.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Looping for copy paste after running analysis

    Hi Finansator,

    If that's what you wanted then this is a lot quicker:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-13-2014
    Location
    Vancouver, WA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: VBA Looping for copy paste after running analysis

    Like a charm! I am truly grateful for your help with this. You're a wizard in my book.

    Best!

    Josh

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA Looping for copy paste after running analysis

    Great - glad it worked - thanks for the feedback and - thanks for the rep!

+ 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. [SOLVED] Help with Looping a copy and paste marco
    By Robert110 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-26-2013, 11:02 AM
  2. [SOLVED] VBA Looping Copy and Paste
    By harrison298 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 11:43 AM
  3. Looping Through Some Sheets to Sort Copy & Paste
    By luke1438 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2010, 12:57 PM
  4. Looping Copy/Paste Macro
    By yuuuh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2010, 11:56 PM
  5. Looping and copy/paste specific rows
    By Desi_bhai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2007, 12:50 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