+ Reply to Thread
Results 1 to 9 of 9

Stack horizontal rows vertically automatically

  1. #1
    Registered User
    Join Date
    09-28-2014
    Location
    SC
    MS-Off Ver
    2013
    Posts
    5

    Stack horizontal rows vertically automatically

    Excel version: 2013
    OS: windows 7, on PC

    I'm trying to get a certain sheet in this case, "Sheet1", into a certain format/layout that dumps the result in "Sheet2". I basically need the rows for each location ID stacked vertically and the location ID entered for each time/row is stacked. The stacking process is going from right to left. It will make better sense looking at the file. In the attached file, Sheet2 is basically what it should look like. The thing is, I need an equation or macro that's scalable to where it can accommodate hundreds and thousands of rows.

    I recorded a macro on a small scale but I'm not good enough to scale it out that large. Any help would save me tremendous amount of time.
    Attached Files Attached Files
    Last edited by HamSandvich; 09-28-2014 at 02:30 PM.
    Windows 7, Excel 2013

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Stack horizontal rows vertically automatically

    This should do it, put this in your module1:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-28-2014
    Location
    SC
    MS-Off Ver
    2013
    Posts
    5

    Re: Stack horizontal rows vertically automatically

    Quote Originally Posted by JBeaucaire View Post
    This should do it, put this in your module1:
    omg, that was quicker than I was expecting. This is what I was looking for. I think I seriously need to learn VBA. I'm not new to programming but never got around to VBA.

    JBeaucaire, can you in laymen terms explain to me what some of those sections in the macro are doing? And is there is row limit to this or is the macro accounting for everything in sheet1? Much thanks!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Stack horizontal rows vertically automatically

    Here's the commented code. If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-28-2014
    Location
    SC
    MS-Off Ver
    2013
    Posts
    5

    Re: Stack horizontal rows vertically automatically

    Quote Originally Posted by JBeaucaire View Post
    Here's the commented code. If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    sure, I'll go ahead and mark that. Also, I hate to do this, i shoulda included this initially but I added a revised spreadsheet in my original post. There's 1 more additional thing I was wondering if its possible.
    I need 1 more column added on "Sheet2" for Status ID. Basically, on sheet1, columns D-N is status id 3 and columns P-Z is status id 2. If you can do that, it will be perfect.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Stack horizontal rows vertically automatically

    Hehe, features creeping in...

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    09-28-2014
    Location
    SC
    MS-Off Ver
    2013
    Posts
    5

    Re: Stack horizontal rows vertically automatically

    Quote Originally Posted by JBeaucaire View Post
    Hehe, features creeping in...
    You're a wizard. When I grow up, I wanna be like you. You saved me tons of headaches.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Stack horizontal rows vertically automatically

    Love to hear it. Pay it forward...

  9. #9
    Registered User
    Join Date
    09-28-2014
    Location
    SC
    MS-Off Ver
    2013
    Posts
    5

    Re: Stack horizontal rows vertically automatically

    Def, will do!

+ 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] Multiple rows of horizontal data needing to arrange vertically (stacked)
    By jpeets645 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-07-2012, 12:07 PM
  2. Summing vertically, if horizontal value is correct
    By asdasdzxc in forum Excel General
    Replies: 14
    Last Post: 07-03-2012, 10:49 AM
  3. Replies: 2
    Last Post: 03-13-2012, 05:40 AM
  4. Referencing cells horizontal and vertically
    By DaveHan in forum Excel General
    Replies: 3
    Last Post: 06-13-2008, 08:12 AM
  5. [SOLVED] How do I link horizontal cells vertically?
    By Brett in forum Excel General
    Replies: 3
    Last Post: 01-04-2006, 12:55 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