+ Reply to Thread
Results 1 to 3 of 3

Unpivot data with VBA

  1. #1
    Registered User
    Join Date
    05-03-2015
    Location
    Gothenburg
    MS-Off Ver
    2016
    Posts
    4

    Unpivot data with VBA

    Hi,

    I have just finished running a VBA that allows me to copy a range from a specific worksheet in multiple workbooks (the sheets are named the same in all workbooks) to a master sheet. However, being rather new to VBA, the module that I ran pastes the ranges below the previously copied worksheet range (see attachment for example) and I'm now presented with the issue of unpivoting this data. I was therefore wondering if there was any Sub pivot_data() VBA script that could help me with my issue.

    In my pasted range, the first column defines week name. The first row of the following column includes a text saying "Date" with 7 dates following that (each in respective columns) indicating every week day. Now I would like to upivot this data based on the week name defined in column A, so that the script identifies Week 1 as the start and then loops through Week 1+1 until there are no more weeks left (maximum of 52), and thus unpivoting the correct dates with the correct orders of the certain products. If I haven't explained myself sufficiently, please refer to the attached file where I have manually constructed the preferred outcome of the VBA.

    Note, the data in the attached file is only an excerpt of the original file. It contains thousands of rows, so would be helpful if this could work.

    Thanks,

    Anton
    Attached Files Attached Files
    Last edited by Anton2; 09-24-2017 at 03:42 PM.

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

    Re: Unpivot data with VBA

    Try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-03-2015
    Location
    Gothenburg
    MS-Off Ver
    2016
    Posts
    4

    Re: Unpivot data with VBA

    Thanks Jindon, worked like a charm.

+ 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] Unpivot data macro
    By logisticsexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2017, 01:17 AM
  2. [SOLVED] Formula to unpivot data
    By chullan88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-10-2017, 03:55 AM
  3. Reshape data and unpivot
    By hpatel517 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2016, 12:22 PM
  4. Unpivot Data
    By naveeddil in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 07-07-2015, 08:04 AM
  5. Unpivot and stack data
    By yching in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-14-2015, 05:18 AM
  6. Unpivot Data
    By Olly in forum Tips and Tutorials
    Replies: 0
    Last Post: 04-02-2014, 05:33 PM
  7. Need 'unpivot' help for attached spreadsheet data.
    By ReneeM787 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-09-2012, 12:21 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