+ Reply to Thread
Results 1 to 13 of 13

Copy the data from Master file and paste into individual excel file as per criteria

  1. #1
    Registered User
    Join Date
    05-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Copy the data from Master file and paste into individual excel file as per criteria

    Dear Experts,

    Friends find Short Description to understand the issue..

    1) I have a master data which I have to update on daily basis. It contains various pivot tables and my report structure with All Circles Master data

    2) After preparation of above data I have to split it circle wise. I Copy the circle wise data from "Master Data" (mentioned in Point 1) and paste it into circle wise individual workbooks which I have already created.

    3) In each circle wise file I have same Pivot tables and other report structure with Master data for particular circle

    Query:

    I need VBA code to copy the Circlewise data from Master File and automatically paste/overwrite it into perticular circle wise file sheet name Master Data (mentioned in Point 3


    Kindly let me know if any other info is needed

    Thanks in Advance
    Vikas_k

  2. #2
    Registered User
    Join Date
    05-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Dear Experts,

    Request you to please help me with the solution

  3. #3
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Hi,
    . I cannot help you with Pivot Tables.
    . Copying data from a Master file based on criteria and pasting into individual excel ( sheets? Or File ?? ) is something me and many people here can do..

    . But in any case, I do not think you have given anything like enough info for anyone to help..in fact you have given next to nothing!!

    . You need to provide a good “picture” BUT NOT IMAGES of what you have , and then what you want.

    . You should produce sheets with reduced test data. They should reflect the situation before and then after the running of any code.

    So: -

    . The Before or Befores, should look just as it / they does before running of any macro.
    .
    . The After or Afters, should be hand filled by you so that it they / looks exactly as you want it to After running of any macro, based on the actual sample data in the Before / or Befores
    . Make sure there is just enough data to demonstrate your need. Remember to desensitize the data if necessary.

    . If you can give a clear picture of what you want , with reduced test data, and no one else picks the Thread up in the meantime, then I will take a look tomorrow

    Alan

    P.s.


    To upload Files : ( Most people use Method 2 )
    . 1 ) use the Forum Tools in my signature to produce screen shots we can copy to a spreadsheet ( NO IMAGES ! )
    . 2 ) Post Files
    . 2 a) To Attach a sample workbook:
    View Pic
    http://www.excelforum.com/members/da...ch-a-file.html
    http://tinyurl.com/oenwprw
    . 2 b) Send over a file sharing site, such as this free thing
    Box Net,
    https://www.box.com/
    http://tinyurl.com/7chr7u8
    . Remember to select Share and give the link / links they give.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  4. #4
    Registered User
    Join Date
    05-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Dear Alan,

    Thank you very much for your reply..and sorry for the incomplete info which I have provided

    Here with attaching my sample data in Excel with sample pivot table

    The thing I want here is mentioned in below points

    1) I have Attached Excel file named as "SAMPLE Master Data", there are 5 sheets one of them is "master data" and others are Pivot sheets

    2) In "master data" sheet, have highlighted the column 'R' where some verticals are given

    3) I want to select each Vertical wise data and Save New File with All sheets including Pivot tables

    4) Name of the file will be the vertical name only

    5) When I will open Each vertical wise file, the Pivot sheets contained in it will get refreshed

    Kindly let me know if any additional info is require

    Regards
    Vikas_k
    Attached Files Attached Files

  5. #5
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Hi, Good day to you.


    Quote Originally Posted by Vikas_k View Post
    .....

    1) I have Attached Excel file named as "SAMPLE Master Data", there are 5 sheets one of them is "master data" and others are Pivot sheets.......
    . Thanks for the File.
    . I am sorry but I still do not understand fully your requirement.
    . (Possibly this is because I do not understand Pivot Tables )
    .
    . I asked you for Before and afters.
    . Possibly what you have supplied me with, is what I meant by a before.
    .
    . I would like you to produce one or more “Afters”, which you fill in manually yourself to show exactly what it is that you want the Macro to do. Remember it , or they, they should be based on the example data you have given in the before. Then when I re-read what you have written I may be able to see more clearly what it is that you want.

    Thank you
    Alan
    .

  6. #6
    Registered User
    Join Date
    05-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Good Day Alan,

    If you do not understand Pivot tables then just assume these are normal worksheets..There is no concern with any pivot table.. I just mentioned it above for the knowledge of file contains..

    I need to Save my Main file "SAMPLE Master data" with different vertical names mentioned in "Column R"

    The challenge is mentioned in below points

    1) I need vertical wise data to be save individually with particular Vertical's name
    2) I need all worksheets in main file also be there in these files
    3) Next time when I run the macro or VBA code These files will overwrite with fresh data
    4) Sample Out put files which I want is also attached now..

    REgards
    Vikas_l
    Attached Files Attached Files

  7. #7
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Hi Vikas,
    . Thanks for the extra info.
    . That makes it very clear
    Quote Originally Posted by Vikas_k View Post
    ....
    If you do not understand Pivot tables then just assume these are normal worksheets..There is no concern with any pivot table.....l
    ... That is what I was hoping, so thanks for confirming that. So I will assume I simply copy those sheets.

    . I will write the code such that it should work with any amount of Pivot table sheets. Indeed you may include any other sheets and they will similarly be copied to the "Vertical" File
    . I will write the code such that a new File is created, should any "Vertical" File not exist. Otherwise the existing Files will have the sheet "Master data" updated


    . I will post again if I have further questions or when I have a code written for you.
    Alan

  8. #8
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Hi Viskas,

    . Here is a code to circumcise your “Vertical” and make new Files with your cut-off bits. ( Apologies if my English is not perfect ) .
    .
    . I find it helpful to put in words what is going on

    . Some general Points then first.
    .
    . There are lots of unnecessary extra steps and comments in the code I need to remember what is going on. It is easy to simplify the code if you wish when you are happy with it.
    .
    . At Excel Forum I can edit my posts for some time after posting, and typically do so to make corrections, Typos etc. So it is worth coming back and getting a fresh copy should you be using the code in the Future.

    . The code is here:
    http://www.excelforum.com/developmen...ml#post4182410
    . And here.
    http://www.excelforum.com/developmen...ml#post4182417
    ....

    . – it was necessary to split the code into two posts to fit it in. However it is one code and you should copy both parts into the same Module, and the second part should go directly under the first part.

    . Some detail to the Code.

    Rem 1) Initial sheet info, Importantly Copying entire data from Master Data to an Array ( arrIn() ). As much as possible is then done “internally” away from the sheet
    Rem 2) if necessary, a Folder Viskas CircumcisedVERTICALs is created in the same directors ( as defultPath ) in which the Master file is found.
    Rem 3) data in VERTICAL column is considered and eunique Array ( eunuch() ) produced from that.
    . Rem 4) Main Outer loop for going through copying data to “vertical” workbooks
    . 4a) Indicies are obtained for the “rows” required in each “vertical” workbook
    . 4b) An Output Array for the “vertical” is made. This "majic bit I still do not understand .
    . http://www.excelforum.com/excel-new-...ba-arrays.html
    Rem 5) An Inner loop will produce if necessary new circumcised “Vertical” Files. It will be assumed, for now, that should a File already exist then it has all the required sheets.
    . 5a). For the case the Files exist, the Master Data sheet is emptied of Data
    . 5b) For the case that the File does not exist, the File is created with no data in Master Data sheet
    . 5c) The filtered Data from Master Data sheet in the Master File is placed in Master data sheet


    . I believe I achieve the results you want, here for example just a small extract of your supplied Master File Master Data Sheet
    Using Excel 2007
    Row\Col
    O
    P
    Q
    R
    S
    T
    1
    ACTIVATED_OB LEGAL_ENTITY GROUP_NAME VERTICAL HQ_CIRCLE REGION
    2
    1.00
    0
    abc System Integrators Cicrle M
    0
    3
    5.00
    0
    xyz System Integrators Cicrle B
    0
    4
    5.00
    0
    vdfd System Integrators Cicrle D
    0
    5
    2.00
    0
    effew System Integrators Cicrle M
    0
    6
    17.00
    0
    abc Strategic Cicrle B
    0
    7
    3.00
    0
    efr Strategic Cicrle M
    0
    8
    6.00
    0
    abc Strategic Cicrle C
    0
    9
    4.00
    0
    eefr NGN Cicrle C
    0
    10
    0.90
    0
    efww NGN Cicrle B
    0
    Master Data

    ...
    And after running the code, here is a small extract of one File , your Strategic “vertical”,
    Using Excel 2007
    Row\Col
    O
    P
    Q
    R
    S
    T
    U
    1
    ACTIVATED_OB LEGAL_ENTITY GROUP_NAME VERTICAL HQ_CIRCLE REGION OB_CREDIT_CIRCLE
    2
    17.00
    0
    abc Strategic Cicrle B
    0
    Cicrle KL
    3
    3.00
    0
    efr Strategic Cicrle M
    0
    Cicrle B
    4
    6.00
    0
    abc Strategic Cicrle C
    0
    Cicrle H
    5
    6
    Master Data

    . The above File is found in a Folder with the name “ViskasCircumcisedVERTICALs”. This File also contains all the Pivot Sheets.
    . If you wish to add Pivot Files in the future to the Master file, you should delete all the Circumcised “Vertical” Files in Folder, “ViskasCircumcisedVERTICALs”. And the program will on the next run produce the Files a fresh with all Pivot Sheets in. Alternatively you can delete the entire folder , “ViskasCircumcisedVERTICALs”, which on the next run the program will make a fresh along with the New files within it.

    . See how you get on and then please reply back and share your findings, and / or ask if you need further help in applying the code.

    . Good day to you. Hope your circumcised verticals meet your requirement
    Alan Elston
    Bavaria
    Germany.
    Last edited by Doc.AElstein; 09-05-2015 at 07:00 PM.

  9. #9
    Registered User
    Join Date
    05-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Dear Alan,

    Thank you very much, I will verify this code and will revert you soon

    Regards
    Vikas_k

  10. #10
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Hi Viskas_k
    Quote Originally Posted by Vikas_k View Post
    .....
    Thank you very much, I will verify this code and will revert you soon
    ......
    . You are welcome.
    . Look forward to you "reverting" and look forward to hearing from you
    Alan
    Last edited by Doc.AElstein; 09-08-2015 at 09:22 AM.

  11. #11
    Registered User
    Join Date
    05-10-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Dear Alan,

    Its Awesome..Superb. Its worked for me

    As of now I have ran this code on my Test files only but very soon I am going to use this in master data.

    I must appreciate for the efforts taken by you to make this code and the description for each line which makes me understand what the code is exactly doing.

    Hatsoff to you..

    Regards
    Vikas_k

  12. #12
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    Hi Viskas,
    Quote Originally Posted by Vikas_k View Post
    ....Superb. Its worked for me...
    . Thanks for the feedback and kind words. Always welcome.
    .
    . I was pleasantly surprised that you were able to take what was quite a long complicated code and get it up and working in your Workbook.
    .
    . There can always be unexpected problems when using real and larger test data. Glad you appreciated the many explaining comments. They may help you to track down and modify the code, should any problems occur later.
    .
    . If i can help any further report back. If you find any useful additions / modifications to the code which might help its implementation when others may have a similar requirement then please post back any relevant suggestions

    . Best wishes and wish you further success in using the code.

    Alan

  13. #13
    Registered User
    Join Date
    03-27-2016
    Location
    United States
    MS-Off Ver
    2010
    Posts
    39

    Re: Copy the data from Master file and paste into individual excel file as per criteria

    This is great Alan!
    I am trying to do something similar except I don't have pivots in my master file. What vertical in Vikas excel is employee in my excel living in column A.

    I posted my query here with before and after. https://www.excelforum.com/excel-pro...ml#post5843502

    I am getting the following error when I tried to access the code you provided
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2572944 bytes) in /home/eforum/public_html/vbseo/includes/functions_vbseo_misc.php on line 98


    Thank you for looking into this, Alan.

+ 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. Replies: 0
    Last Post: 04-29-2015, 10:59 PM
  2. [SOLVED] copy columns from individual files and paste in another excel file
    By kuntalnr in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-04-2015, 10:18 AM
  3. Copy and Paste Data from files to Master File thru Macro
    By soumendu_bose in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2014, 05:48 AM
  4. Making a MASTER-FILE that collects individual file information
    By InterstateRentals in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2013, 09:10 AM
  5. Copy paste data from a Master file to Multiple Reports
    By spiwere in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 07-21-2013, 01:22 PM
  6. [SOLVED] VBA for save individual excel file .. with master file
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-01-2012, 01:10 PM
  7. Copy data from new everyday csv file to next empty row in master excel file
    By hablu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2009, 02:06 AM

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