+ Reply to Thread
Results 1 to 5 of 5

Macro for copying data from pivot table to other workbook

  1. #1
    Forum Contributor
    Join Date
    04-29-2011
    Location
    South Korea
    MS-Off Ver
    Excel 2019
    Posts
    176

    Macro for copying data from pivot table to other workbook

    Task:
    I need to get some data from pivot table and copied to the summary file according to specific account managers. Previously, I get the useful macro, however, after I run in the office, it has some problems.

    After I use in the office, it has the following problems:

    1. If the account manager's name in pivot table is Alexander Dyste-99999*, as I run the macro, in the PCT-After.xls, the data of % Primary sales of closed leads (maturing mortgage
    maturing term deposit and signficiant deposit) data will be wrong

    2. If the account manager's name in pivot table is gordon d Lam 99999e*, as I run the macro, in the PCT=After.xls, the macro doesn't copy any data in the PCT-after.xls

    3. After I run macro, in PCT-after.xls, the date in row 22 (for example), it will be ' in the cell rather than the dd-mm-yy (e.g. 18-Jun-11). I create the similar file at home, it works. I don't why there is problem in the office file.



    How can I modify the following code, therefore, I can copy data from pivot table to summary file correctly?

    Thank you, if you can give me reply and appreciate your effort

    This time, I use more than one hour to prepare PCt-desire result excel and PCt-after.xls.
    PCT-DESIRE is for my desired result
    PCT-after.xls is my simulation file in office

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro for copying data from pivot table to other workbook

    hi, ronlau123,

    1. Corrected to accept any format of last name + something

    2. Corrected in 1

    3. Names of the Sheets in PCT-file MUST be the same with the Last names in Sheet "Name list"
    I've noticed that there are two options of name and sheet name transcription:

    1. Sheet "Name List" - "Yasaman Deep " - with end space, sheet created with name "Yasaman Deep". The code is looking for "Yasaman Deep" sheet and can not locate it. To correct that the code had a trim function to cut off any extra spaces and it worked good but for the second option.
    2. Sheet "Name List" - "gordon d Lam " with end space, sheet created with name "gordon d Lam ". The code trims his last name to "gordon d Lam" and can not locate his sheet and does not copy any data.

    If you amend sheet name from "gordon d Lam " to "gordon d Lam" - without end space everything would be as expected.

    So, if you accept as a rule of thumb to create sheets exactly under the names in Names list, I will amend code not to delete any spaces. This data must be consistent.
    Attached Files Attached Files
    Last edited by watersev; 06-22-2011 at 05:12 AM.

  3. #3
    Forum Contributor
    Join Date
    04-29-2011
    Location
    South Korea
    MS-Off Ver
    Excel 2019
    Posts
    176

    Re: Macro for copying data from pivot table to other workbook

    Dear all,

    May I ask one more thing? After I use the file in office, there are following problems:

    1. For each account manager sheet, date will be turned to blank cell. For example, as I use macro to paste data on pct-after.xls, the date in column A of each account manager is deleted.

    2. Sometimes, data copied to pct-after.xls on each account manager sheet is wrong.
    I give you the following example,

    in pivot table, there are 4 account managers, 1. david, 2. john 3. may 4. Gordon.
    However, if data of May can't be copied to PCT-after.xls (because of spacing in pivot table, sometime, the account name is like as May 99999*), then data of Gordon copied on the pct-after.xls is incorrect.

    Thanks

  4. #4
    Forum Contributor
    Join Date
    04-29-2011
    Location
    South Korea
    MS-Off Ver
    Excel 2019
    Posts
    176

    Re: (solved) Macro for copying data from pivot table to other workbook

    Dear all big brothers and sister,

    Is it possible to modified the following macro if the table label is merged? (I posted the file as an example).

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by ronlau123; 08-10-2011 at 12:21 AM.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro for copying data from pivot table to other workbook

    hi, ronlau, please check attachment, please check if everything is OK
    Attached Files Attached Files

+ 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