+ Reply to Thread
Results 1 to 6 of 6

Convert Multiple Columns to Rows including blank cells

  1. #1
    Registered User
    Join Date
    03-04-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Convert Multiple Columns to Rows including blank cells

    I currently have a spreadsheet that I had someone help me to convert from multiple rows to columns:

    http://www.excelforum.com/excel-prog...-new-post.html

    Now I need a script to change the data so that each column is now in row format, (see attached spreadsheet).

    Thanks in advance for your help.
    Attached Files Attached Files

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Convert Multiple Columns to Rows including blank cells

    Hello BJPhil,

    The macro below has been added to the attached workbook. If have any problems with it, let me know.
    A button (Run) has also been been added to the worksheet to run the macro.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-04-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Convert Multiple Columns to Rows including blank cells

    Leith.....

    This partially works. The number of columns will vary in the spreadsheet that I need to run this script on. It could have 30 columns or 8 columns. Can you make the script variable as the number of columns to work on?

    Thanks for your effort.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Convert Multiple Columns to Rows including blank cells

    Hello BJPhil,

    I wrote the macro based on the sample workbook. In it, your column headers are all contiguous (no blank cells). This is how the macro determines the number of columns on the worksheet.

    The number of rows is determined by the number of entries in column "A". The macro now knows the size of the range to examine. Only the output in "A11:E11" is fixed.

    My assumption then is the output range "A11:E11" needs to be moved below the last row of data. Is that what you want?
    Last edited by Leith Ross; 04-14-2014 at 02:19 PM.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Convert Multiple Columns to Rows including blank cells

    Hello BJPhil,

    Here is another version of the workbook. This version has the data to be converted on "Sheet1", the source, and the results are output to "Sheet2", the destination. The button to run the macro has been moved to "Sheet2" also.

    New Macro
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-04-2014
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Convert Multiple Columns to Rows including blank cells

    Leith,

    Yes, that is correct. the output range needs to adjust depending on the number of rows.

    the sheet that I'm trying to use this script on has some rows that contain 8 columns and some rows with data in 25 columns. I submitted the "sample" spreadsheet to convey the idea of what I was trying to accomplish. The sheet that I have has over 2,000 rows of data with variable number of columns for each row.

    Hope this helps and I really appreciate your efforts.

+ 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] Transpose Duplicate rows into columns including blank cells
    By BJPhil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-07-2014, 12:08 PM
  2. COUNTIFS, multiple criteria and not including blank cells
    By qhoney in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2014, 05:14 PM
  3. Convert many non-blank columns to rows
    By smytgemm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2013, 09:22 AM
  4. Replies: 1
    Last Post: 11-29-2012, 06:24 PM
  5. Count blank cells within a range not including fully blank rows
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-16-2008, 09:43 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