+ Reply to Thread
Results 1 to 4 of 4

loop copy and past cells

  1. #1
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    56

    loop copy and past cells

    I need help creating a loop that will go down a row and copy data to the adjacent cell and paste that data until the condition is met.
    I have data in cells a1:a1000 which are dates and then in cells b1:b1000 data.

    In cell h1 is a date which will be any start date the user enters: h1: 2/1/2008
    In cell H2 is the end date which the user enters: 3/1/2009

    I need the loop to find the first date entered in h1 in column and once found continue to copy all the data to the adjacent going down until the end date is reached which comes from H2. ALL THE dates increase by month and year. I then need it to copy and paste to another cell in another worksheet.

    I only have a little bit of the program:
    Please Login or Register  to view this content.
    I am not sure which loop to use and how I would tell the loop to go down in the row A, and when it finds the date to copy the data to the adjacent cell and keep going until the end date which comes from H2-saved as "Y" in the program. Then I need it to take all the data and paste it in another worksheet.

    Please let me know if you can help... The rest of the program after that I can do, loops are one of my biggest weaknesses.
    Last edited by davesexcel; 10-16-2010 at 08:05 AM.

  2. #2
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: loop copy and past cells

    Enclosed is a document, as you can see i have data two rows and then in row F3 a start date and in f4 an end date. I want to be able to change these dates and when the loop runs it goes and gets the "cost" data adjacent to the start date and continues to copy it until the "end date", and then pastes it in sheet 2.


    thanks for your help
    Attached Files Attached Files

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

    Re: loop copy and past cells

    Check out the example workbook from this thread
    http://www.excelforum.com/excel-gene...ml#post1873133

    Your example should be
    =SUMIF(B5:B43,"<="&F4,C5:C43)-SUMIF(B5:B43,"<"&F3,C5:C43)

  4. #4
    Registered User
    Join Date
    10-15-2010
    Location
    Sacramento, CA
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: loop copy and past cells

    Dave,

    thank you, it seems like im in the right direction, but its not calculating right. Its not adding the data to much. For example if the first 2 dates have a sum in the next column of 10, the formula says 8, which is strange.

    So I modified it instead of (-) i put a (+), but still the same problem.

    =SUMIF(B5:B43,"<="&F4,C5:C43) + SUMIF(B5:B43,"<"&F3,C5:C43)

    Instead of adding this data is there away to multiple this date instead, like a product if formula?

    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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