+ Reply to Thread
Results 1 to 10 of 10

combine many columns data into half columns data by creating rows

  1. #1
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    18

    combine many columns data into half columns data by creating rows

    Hi all

    need an urgent help

    i have excel sheet which contains

    sapid 1 2 3 4 5 6
    10000001 g g g g off m
    10000002 m m m off g g
    10000003 m1 m1 off g g g
    10000004 m2 off m1 m1 m1 m1

    sapid , 1 ,2 ,3... these are the colomn names
    but i want in following format

    sapid 1 2 3 4
    10000001 g g g g
    10000001 off m
    10000002 m m m off
    10000002 g g
    10000003 m1 m1 off g
    10000003 g g
    10000004 m2 off m1 m1
    10000004 m1 m1


    i hope u understand

    regards
    killerware

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: combine many columns data into half columns data by creating rows

    Your question will be easy to understand with the help of a sample file.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: combine many columns data into half columns data by creating rows

    Hi

    please find the attachment

    regards

    killerware
    Attached Files Attached Files

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: combine many columns data into half columns data by creating rows

    Try this code -
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose Tools | Macro | Macros
    Select a macro in the list, and click the Run button

  5. #5
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: combine many columns data into half columns data by creating rows

    Hi friend,

    Your macro code is working fine.
    but what can i do if i want to change the format for more than 6 coloumns and combine it in more tha or less than 4 columns

    cal u tell me where i can change the code

    Regards

    killerware

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: combine many columns data into half columns data by creating rows

    Greater than 6 columns is already taken care of in the code.

    To take care of > or < 4 columns - see below -

    Your 4th column in this case was column G which is the 7th column from column A. So accordingly you need to change the highlighted numbers in the following lines of code -
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: combine many columns data into half columns data by creating rows

    Hi friend

    I changed the code as per ur suggestions but now i got the new problem

    i put this code

    Please Login or Register  to view this content.
    by putting this i got the result but its not correct bcoz only 4th row is divided
    1st three rows are not dividing please help
    attaching u excel also

    refer sheet 2

    regards
    killerware
    Last edited by arlu1201; 03-08-2013 at 07:36 AM.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: combine many columns data into half columns data by creating rows

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.

    From which row does your data start? This code asks to start from row 5, with headers being in row 4.

  9. #9
    Registered User
    Join Date
    03-08-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    18

    Red face Re: combine many columns data into half columns data by creating rows

    Hi Friend

    I got ur point according i have change the code
    working amazingly

    Thank u so much

    Regards
    killerware

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: combine many columns data into half columns data by creating rows

    Am glad it worked.

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.

+ 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