+ Reply to Thread
Results 1 to 2 of 2

Write to multiple text files from multiple Excel worksheets based on some conditions

  1. #1
    Registered User
    Join Date
    08-14-2009
    Location
    DXB
    MS-Off Ver
    Excel 2007
    Posts
    3

    Write to multiple text files from multiple Excel worksheets based on some conditions

    Dear Experts,


    Salesman Territory Sub Territory Total
    Harry North Sector1 150
    Harry South Sector1 246
    Evellyn North Sector1 433
    Evellyn North Sector2 767
    Evellyn East Sector1 1345
    Jerry East Sector2 3428
    Jerry East Sector3 456
    Jerry East Sector4 256
    Jerry West Sector3 789
    Jerry West Sector2 488


    I have a worksheet with data such that the column A will have data with the names of salesmen, Column B the territories he is assigned, Column C the sub territories and Column the sales and so forth. I have a macro which will split the data into different worksheets with the salesmen’s name as the worksheet name i.e. I will have worksheet with names Harry, Evellyn, Jerry with each containing the data of the respective salesmen only.

    Now I would like to have a macro that will run only on all the newly created worksheets (Harry, Evellyn and Jerry) and not on the main worksheet that will write the data into different text files, i.e. the data of Data of Harry worksheet into Harry.TXT, Data of Evellyn worksheet into evellyn.txt etc…in the following format:

    **************Jerry Record*************

    “Following are the details of Jerry”

    Territory: East

    SubTerritory: Sector1, Total :3428
    SubTerritory: Sector2, Total :456
    SubTerritory: Sector3, Total :256

    Total for Territory East for Jerry : 4140

    Territory:West

    SubTerritory: Sector1, Total :789
    SubTerritory: Sector2, Total :488

    Total for Territory West for Jerry : 1277

    Total for Territory : 5417

    **************Jerry Record*************
    Last edited by E-tech; 12-05-2010 at 05:02 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Excel Macro to export to text based on some conditions

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE DON'T USE UNNECESSARY WORDS LIKE EXCEL MACRO
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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