Consulting

Results 1 to 3 of 3

Thread: Writing a .CSV file (.txt) from a Sheet

  1. #1
    VBAX Newbie
    Joined
    Mar 2011
    Posts
    2
    Location

    Writing a .CSV file (.txt) from a Sheet

    I'm with a problem in a project, I couldn't write a code that turns my sheet into a .csv, using delimted spaces for each cell.

    For instance:

    On A column, there will have dates, on format YYYYMMDD.
    On B, there will be a string, with 4 digits, from there, I need to get spacements fixed for variables.
    The variables may have from 1 to 10 digits, the space on the .csv must be 10 digits, if there the variable has, for example, 8, it must be like this ( 12345678)

    I tried to use the article " CustomDelimitedExport" but I didn't have any success with it.

    I'm hoping that u can help me with it.

    Thx dudes, any question, please ask.

  2. #2
    VBAX Regular
    Joined
    Mar 2011
    Posts
    27
    Location
    Can you attach a sample excel file that you are trying to turn into a .csv file?

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could convert your strings to 10 characters.

    =REPT(" ",10-LEN(B1))&B1
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •