+ Reply to Thread
Results 1 to 11 of 11

Loop Horizontal (across) to copy and paste Vertically (Down)

  1. #1
    Registered User
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    MS Office Professional 2010
    Posts
    30

    Post Loop Horizontal (across) to copy and paste Vertically (Down)

    Hi everyone,
    I wanted to see if you guys could help me with a loop. I have a report that prints out across the sheet horizontally. I need it to show the data in a vertical layout instead. So this is what I know I need so far...start at J4 and move over 12 cells across and 4 down. So J4:V8... copy that and bring it down and paste it at A10. Then continue doing that 7 more times. So it needs to go to W4 and then go over 12 cells and down 4 and copy that and bring it under what was just pasted..so right at A16... then continue till it does this 7 times. Then i need it to do another loops after the 7th time (so it should start at DJ4, same concept but this time the loop would only go over 10 cells and down 4. It will need to do this one until it finds nothing else to copy (since this area is not fixed like the one above that has 7 items).

    I was able to get this code but I haven't been able to make it work the way I want.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    Can you post an example worksheet that shows a before and after? Doesn't have to be a ton of data, and it can be made up, just need to see what you want where.
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    Maybe:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    MS Office Professional 2010
    Posts
    30

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)


  5. #5
    Registered User
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    MS Office Professional 2010
    Posts
    30

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    HI John,
    for some reason it stopped at CV but CW still had data. So technically it needed to do the first part 1 more time. then do the second part where it looks over only 10 cells.

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    =You can use the picture icon (with the tree in it) to upload a workbook as well.

  7. #7
    Registered User
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    MS Office Professional 2010
    Posts
    30

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    ExcelForum_Template (Loop).xlsx

    Here you go Walrus! Thanks!

  8. #8
    Registered User
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    MS Office Professional 2010
    Posts
    30

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    Quote Originally Posted by rubenidas View Post
    HI John,
    for some reason it stopped at CV but CW still had data. So technically it needed to do the first part 1 more time. then do the second part where it looks over only 10 cells.
    Ok so i changed i=7 to i=8 and it completed the first part successfully. Oh and i also changes .copy to .cut so it would cut the data instead. But how do i get it to run the second part where it does the same but only for 10 cells across untill it finds nothing?

  9. #9
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    Maybe:

    Please Login or Register  to view this content.
    Sorry, I missed the second part of your request.
    Last edited by JOHN H. DAVIS; 04-28-2016 at 02:14 PM.

  10. #10
    Registered User
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    MS Office Professional 2010
    Posts
    30

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.
    Sorry, I missed the second part of your request.
    Thanks John!, This worked perfectly!
    You Rock!

  11. #11
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Loop Horizontal (across) to copy and paste Vertically (Down)

    You're welcome. Glad to help out and thanks for the feedback and the reps.

+ 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. transpose horizontal values vertically
    By sugargenius in forum Excel General
    Replies: 4
    Last Post: 04-07-2015, 09:50 AM
  2. Replies: 4
    Last Post: 08-05-2014, 11:33 AM
  3. Arrange horizontal data to vertical through cut, paste, loop
    By kcheeser in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 03-26-2014, 04:12 PM
  4. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  5. Replies: 0
    Last Post: 11-27-2012, 10:32 AM
  6. Summing vertically, if horizontal value is correct
    By asdasdzxc in forum Excel General
    Replies: 14
    Last Post: 07-03-2012, 10:49 AM
  7. Referencing cells horizontal and vertically
    By DaveHan in forum Excel General
    Replies: 3
    Last Post: 06-13-2008, 08:12 AM

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