+ Reply to Thread
Results 1 to 7 of 7

Convert Multiple Columns to Rows depending on an Input Value

  1. #1
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Convert Multiple Columns to Rows depending on an Input Value

    Hello All,
    I have lot of data in Excel 2010 which I wish to bring in Columns using a Macro depending on the input value which the macro should prompt me.
    For Eg:

    A1 B1 C1 D1 E1 F1 G1 H1 I1 J1
    1 2 3 4 5 6 7 8 9 10
    1 2 3 4 5 6 7 8 9 10
    1 2 3 4 5 6 7 8 9 10
    1 2 3 4 5 6 7 8 9 10
    1 2 3 4 5 6 7 8 9 10


    If I select data from A1 and J1 (in practical it will be more Columns) the Macro should prompt me how many Columns would be the output on Master Sheet.
    If the input is 2 then it should create an output Sheet ‘Master’ and should show the following result
    A1 B1
    1 2
    1 2
    1 2
    1 2
    1 2
    3 4
    3 4
    3 4
    3 4
    3 4
    5 6
    5 6
    5 6
    5 6
    5 6
    .. ..
    .. ..
    It after selection I run the macro and input 3 then the output should go in three columns (A1,B1,C1) one below other. If 4 is Input then 4 Columns (A1,B1,C1,D1) will come below each other so on and so forth.
    I hope this gives the idea.
    Any help would be greatly appreciated.
    TIA
    Rashid Khan
    Last edited by prkhan56; 07-07-2014 at 04:03 PM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Convert Multiple Columns to Rows depending on an Input Value

    Try next code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Convert Multiple Columns to Rows depending on an Input Value

    Try
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Convert Multiple Columns to Rows depending on an Input Value

    Hello Jindon,
    Thanks for the prompt reply. Your code works great. I need to get some modifications please.

    Sorry I missed the Heading Part in my original post. First Row within the Selection would be Headings. It copies the Headings too.
    See Master Sheet in the Sample file attached.
    I have mentioned the results required.

    Also would it be possible to modify the code to work on all the sheets in the Workbook except the Master sheet and append the data of each sheet below in the Master Sheet.

    Thanks once again.

    You are a great help.
    Rashid Khan

  5. #5
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Convert Multiple Columns to Rows depending on an Input Value

    Hello PCI,
    Thanks for the code.
    But it does not give the desired result as per my original post.
    Code provided by Jindon suits my requirement.
    Thanks for your time.
    Rashid Khan

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Convert Multiple Columns to Rows depending on an Input Value

    Not really sure if this is what you wanted.
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    06-03-2004
    Location
    India
    MS-Off Ver
    2013
    Posts
    205

    Re: Convert Multiple Columns to Rows depending on an Input Value

    Works like a charm!
    Thanks a lot for your time and help
    Really appreciated
    Rashid Khan

+ 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. Convert multiple columns to rows
    By Lois Lane in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-13-2015, 03:05 AM
  2. Combining multiple rows from 2 columns into sorted columns depending on 1st columns value
    By Dexamphetamine in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2013, 10:00 AM
  3. Replies: 1
    Last Post: 11-29-2012, 06:24 PM
  4. [SOLVED] Finding multiple matches of a single input across multiple rows and columns
    By gingerdog in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-07-2012, 02:54 PM
  5. To convert data in multiple sets of columns to multiple rows
    By Dhanya_nair in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2012, 02:49 PM

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