+ Reply to Thread
Results 1 to 11 of 11

VBA to manipulate pivot table in to 'normal' table for account software upload

  1. #1
    Registered User
    Join Date
    11-03-2020
    Location
    London
    MS-Off Ver
    2016
    Posts
    29

    VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi experts,

    I need help to manipulate pivot table data into a specific template so I can upload this template into accounting software.

    I have attached a file that shows an example of the pivot table data, the Acct template which will be uploaded to the accounting software, and a description tab for the Acct template tab to explain the structure and content of the template.

    I need help with the following as I am a VBA beginner:

    1. For each row in the pivot table, I need the Acct Template tab to be split into two rows, one row showing the income and the VAT and the other row showing the service charge.

    2. The split row with the income and VAT needs to show 'is' for the Class column and 'SALES' for the description column

    3. Each store has a letter(s) code, the Marks column needs to show the store code as below. The name of the stores in part of the text in column A in the pivot table.

    Greengates = r
    Shipley = l
    Crossgates = xg
    Starbeck = st
    Dewsbury =db
    Hunslet =hl

    4. The VAT values need to have the lower case letter 'l' after the numerical figure

    5. The Reference, Rec. and Rec. Balance columns need to stay blank.

    I realise this is a lot of work but if someone could help me with points 1 and 2 I am sure I can work out the rest.

    Many thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi, I have following solution for you:
    Please Login or Register  to view this content.
    Cheers
    Erwin
    Attached Files Attached Files
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    Registered User
    Join Date
    11-03-2020
    Location
    London
    MS-Off Ver
    2016
    Posts
    29

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi Erwin,

    Thanks for this, it is almost there. I found a couple of issues:

    1. I get two rows for the data from the 9th which is great but, I only get one row (the SALES row) for the 10th, the sales commission row is missing
    2. When the data is added to the table, it is offset by one column to the right. So the data that should be in column 1 is in column 2

    Can you help fix these issues?

    Thanks,
    Sahil

  4. #4
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi Sahil,
    that is strange, I do not experience those issues, perhaps you can send me an updated file, or the files that is having those issues.

    see attachment

    Cheers
    Erwin

    PM Looking at your comment it looks like you did not use :
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Eastw00d; 08-29-2021 at 02:35 PM. Reason: additional info

  5. #5
    Registered User
    Join Date
    11-03-2020
    Location
    London
    MS-Off Ver
    2016
    Posts
    29

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi Erwin,

    I have attached my full spreadsheet in case some of the extra data I have in there is making a difference. If you run the Sub New_List() macro, at the bottom of the long list of code, you will see the data populate the 'MM Template' tab with the following issues:

    1. The last row of data in the pivot table is only showing the SALES row after running the macro
    2. The data when added to the table is offset by one column to the right
    3. The vlookup for the store code seems to break partway down the list and all of them below row 15 shows 'xg'

    Thanks,
    Sahil
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi, I have looked into this matter, and there was one error of my part: (that is the reason why the vlookup doesn't work properly)
    you must change this:
    Please Login or Register  to view this content.
    and the reason why it does not place the code in the right cells is that you have to place both Option Explicit and Option Base 1 as first lines in the code module.

    It should now work properly!
    I have attached the new file.

    Cheers
    Erwin
    Last edited by Eastw00d; 09-02-2021 at 12:34 PM. Reason: typo

  7. #7
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi Sahil,

    While Eastw00d's solution is working perfectly, this is another option that would get you the required results directly from "VAT" sheet without the need to create a Pivot Table, if interested
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  8. #8
    Registered User
    Join Date
    11-03-2020
    Location
    London
    MS-Off Ver
    2016
    Posts
    29

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Hi Nankw83,

    This works perfectly apart from the date. It shows is at MM-DD-YYYY and I need it as DD-MM-YYYY. All the data is for August so it should be DD-08-2021.

    I have tried using the below code to change it but it doesn't seem to do anything, presumably because it thinks it is the in the DD-MM-YYYY format to begin with.

    Sheet1.Range("A2", "A50000").NumberFormat = "dd-mm-yyyy"

    Thanks,
    Sahil

  9. #9
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Try to make couple of changes below & see if that helps ...
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    11-03-2020
    Location
    London
    MS-Off Ver
    2016
    Posts
    29

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Amazing, this has worked now!

  11. #11
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: VBA to manipulate pivot table in to 'normal' table for account software upload

    Glad to help & thanks for the added Rep+

+ 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. Pivot Table Slicers and Screenreaders (Jaws software)
    By llewis in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 02-04-2016, 04:45 PM
  2. Normal chart from pivot table
    By smithy88 in forum Excel General
    Replies: 0
    Last Post: 04-02-2012, 05:12 AM
  3. Manipulate data table below the pivot chart
    By Malette in forum Excel General
    Replies: 7
    Last Post: 03-28-2012, 11:45 AM
  4. Normal Chart From Pivot Table Data
    By blatham in forum Excel General
    Replies: 1
    Last Post: 10-19-2006, 08:46 AM
  5. [SOLVED] Convert Pivot Table to Normal Data table
    By ashish128 in forum Excel General
    Replies: 2
    Last Post: 05-02-2006, 04:40 AM
  6. [SOLVED] Can't manipulate pivot table
    By Grrffin in forum Excel General
    Replies: 1
    Last Post: 11-17-2005, 01:15 AM
  7. How do I manipulate pivot table report to include percentage of?
    By KRUEMJ-Needs some help in forum Excel General
    Replies: 2
    Last Post: 01-30-2005, 10:06 PM

Tags for this Thread

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