+ Reply to Thread
Results 1 to 7 of 7

Export Colum to txt for each worksheet

  1. #1
    Registered User
    Join Date
    01-21-2014
    Location
    Spain
    MS-Off Ver
    Excel 2010
    Posts
    4

    Export Colum to txt for each worksheet

    Hi everyone,

    I am starting to work with VBA, my programming skills are limited so I am able to understand code, but it is difficult to create one from scratch.

    Scenario:
    I have an excel, with several worksheets (about 11), with information in the first colum.

    Macro1:
    I would like to export the first colum (omitting the first row) to a txt file with the same format, I will need as many macros as worksheets I have.

    1- The txt file should be created in the same folder where the excel file is.
    2- The filename should be first 13 charactes of the excel filename + the worksheet/tab name + v0.1
    3- If possible every time you run the macro v0.1 at the end of the filename should be incremented (this step is not completelly neccesary but I would like to see how it is done to learn)

    Macro2:

    I would like to have a separate macro to do the same for all the worksheets starting in the 5th one (the first four are not required). It is to generate the txt for all the worksheets at the same time.

    I have managed to export the worksheet to a txt file, but I am lost regarding the filename and the macro 2.

    Any help is welcome, thank you.

  2. #2
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Export Colum to txt for each worksheet

    Here an example of what you can do.
    The macro reads the first column of each sheet (starting at the fifth sheet) and generates a text file with version number for each sheet.
    Name of text file is first 13 characters of workbook name, sheet name and version number.
    Hope it helps u....


    Greetings
    Gerard

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-21-2014
    Location
    Spain
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Export Colum to txt for each worksheet

    Hi Gerard,

    Really nice program, I can understand almost everything, I am trying now to place all the files in other folder in the same directory.

    Please Login or Register  to view this content.
    It works ok, problem is that if I run the macro again it gives me an error I guess because the folder is already created, I am trying to use an if else go to sentence but I dont mange to get it could you please help me?

    Thank you,

  4. #4
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Export Colum to txt for each worksheet

    You need to check if the directory is present

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-21-2014
    Location
    Spain
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Export Colum to txt for each worksheet

    So easy, I was looking for a much difficult way. I have some knowledbe about C# (a little bit rusted) could you please recommend me a good book or guide to learn VBA language?

    Many thanks Gerard for your help.

  6. #6
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Export Colum to txt for each worksheet

    Quote Originally Posted by [email protected] View Post
    So easy, I was looking for a much difficult way. I have some knowledbe about C# (a little bit rusted) could you please recommend me a good book or guide to learn VBA language?

    Many thanks Gerard for your help.
    Good books?
    I don't know, never used a book.

    Most of the VBA I have learned is from reading forums, helping others with there problems and attempting to program almost impossible code macro's. Still learning every day.
    It helps to start a code library from what u can pull code snippets....
    My opinion is that there is more info on the forum(s) than you can ever find in a good book.

    Greetings
    Gerard

  7. #7
    Registered User
    Join Date
    01-21-2014
    Location
    Spain
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Export Colum to txt for each worksheet

    Hi,

    I am still working with this Macro and I am trying to do a good way to do it but I do not find it. I want to run the macro getting the first colum for all the sheets except for one of then "sh-example" where I want to export 3 colums.

    Any idea using the same macro?

    Regards,

+ 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. need a macro if row is text is constant then other colum shd copy n paste in other colum
    By uttam.mothe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2013, 12:17 PM
  2. Formula Help matchin colum a with colum b to display colum c
    By dbe82 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-08-2013, 10:11 PM
  3. copy and paste colum K to colom R and skip filled cells colum R
    By jdrmer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2012, 10:30 AM
  4. How to shift range of values from a colum to another colum at a programmed cell.
    By lolypop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2007, 06:24 PM
  5. paste to next free colum on new Worksheet
    By Ralph in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2006, 07:35 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