+ Reply to Thread
Results 1 to 3 of 3

fixed width file?

  1. #1
    Registered User
    Join Date
    02-24-2006
    Posts
    24

    fixed width file?

    I have a worksheet that I need to transform to a fixed width file.
    Current data set includes:
    10
    -25.2
    25.33
    etc.
    I need to convert the . to , and then ensure it is in the following format:
    +0000000010,0000000
    -0000000025,2000000

    currently, I am using loop to review every row
    ie. if sign(activecell)<0 then "-" else "+"
    but I'm stuck on the 0 padding and 0 padding at the end.
    Any help will be greatly appreciated.

  2. #2
    AA2e72E
    Guest

    RE: fixed width file?

    You need to learn the VBA Format command: see the help files.

    "kwiklearner" wrote:

    >
    > I have a worksheet that I need to transform to a fixed width file.
    > Current data set includes:
    > 10
    > -25.2
    > 25.33
    > etc.
    > I need to convert the . to , and then ensure it is in the following
    > format:
    > +0000000010,0000000
    > -0000000025,2000000
    >
    > currently, I am using loop to review every row
    > ie. if sign(activecell)<0 then "-" else "+"
    > but I'm stuck on the 0 padding and 0 padding at the end.
    > Any help will be greatly appreciated.
    >
    >
    > --
    > kwiklearner
    > ------------------------------------------------------------------------
    > kwiklearner's Profile: http://www.excelforum.com/member.php...o&userid=31909
    > View this thread: http://www.excelforum.com/showthread...hreadid=521908
    >
    >


  3. #3
    Dave Peterson
    Guest

    Re: fixed width file?

    I'd use a helper column with a formula like:

    =SUBSTITUTE(TEXT(A1,"[<0]-0000000000.0000000;[>=0]+0000000000.0000000"),".",",")

    Then I'd copy that column and paste into NotePad. And save it as that text file
    from Notepad.



    kwiklearner wrote:
    >
    > I have a worksheet that I need to transform to a fixed width file.
    > Current data set includes:
    > 10
    > -25.2
    > 25.33
    > etc.
    > I need to convert the . to , and then ensure it is in the following
    > format:
    > +0000000010,0000000
    > -0000000025,2000000
    >
    > currently, I am using loop to review every row
    > ie. if sign(activecell)<0 then "-" else "+"
    > but I'm stuck on the 0 padding and 0 padding at the end.
    > Any help will be greatly appreciated.
    >
    > --
    > kwiklearner
    > ------------------------------------------------------------------------
    > kwiklearner's Profile: http://www.excelforum.com/member.php...o&userid=31909
    > View this thread: http://www.excelforum.com/showthread...hreadid=521908


    --

    Dave Peterson

+ 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