+ Reply to Thread
Results 1 to 5 of 5

Macro to Unpivot a Flat Data with Merged headings

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

    Macro to Unpivot a Flat Data with Merged headings

    Dear All,

    I am using Excel 2010 and have problem as shown on Input Sheet on attached sample

    I have data with Merged Cells in Row 1

    Cells A1, B1 and C1 are Blanks

    Data shown is for few rows. Actual Data is several rows down

    Merged Cells starts from 1st Column in each Data Set. Last Column under each Region is not under the Merged Cells
    Heading under each Region also will differ

    The data is separated by a Blank Column in between

    Details are Text Entries

    Data are numeric entries

    I want a macro to give me the result as shown on the Output Sheet

    Any help would be appreciated
    TIA
    Rashid Khan
    Attached Files Attached Files
    Last edited by prkhan56; 11-01-2017 at 11:27 AM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro to Unpivot a Flat Data with Merged headings

    Try this

    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010/2013.
    Martin

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

    Re: Macro to Unpivot a Flat Data with Merged headings

    Dear Martin
    Thanks for your code. Works great.

    I had made the Input and Output sheet for explanation purposes.

    Few tweaks then it would be the perfect solution for my problem

    1) Can the macro add a new sheet 'Output' when it is running?
    2) Can the could be amended to run on active sheet?

    As I would be using this macro every time a report is generated and there will be no Input or Output sheet in my data
    My data will have only one sheet

    With the present code I will have to change the sheet name to Input and create a new sheet as Output.
    You understand what I mean

    Thanks once again for your time and help

    Regards
    Rashid

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Macro to Unpivot a Flat Data with Merged headings

    Try

    Please Login or Register  to view this content.

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

    Re: Macro to Unpivot a Flat Data with Merged headings

    Dear Martin,
    Thanks a lot
    Great help

    Post marked Solved

    Rashid

+ 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. Unpivot data with VBA
    By Anton2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2017, 05:30 AM
  2. [SOLVED] Unpivot data macro
    By logisticsexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2017, 01:17 AM
  3. Macro to compare two flat files and copy missing value to new flat file
    By pratheepm7 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2017, 02:15 PM
  4. Unpivot Macro
    By nigelbloomy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-02-2015, 05:25 PM
  5. Unpivot Data
    By naveeddil in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-07-2015, 08:04 AM
  6. Unpivot Data
    By Olly in forum Tips and Tutorials
    Replies: 0
    Last Post: 04-02-2014, 05:33 PM
  7. Coding for offset cell references with multiple row headings with merged cells
    By AndyE in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-04-2010, 02:22 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