+ Reply to Thread
Results 1 to 2 of 2

Converting from Excel into a fixed length record

  1. #1
    Gavin
    Guest

    Converting from Excel into a fixed length record

    A simplified example of what I need to do.

    I have the following cells in Excel A1=xxx, A2=yyyyy and A3=zzzzz
    which I need to convert in a fixed length record with offsets of 0, 5 & 13
    so that it looks like this "xxx yyyyy zzzzz"

    If the field is a numeric I can use custom option to format the field to the
    appropriate no. of characters but how do I do this for an alpha field ?

  2. #2
    Patrick Molloy
    Guest

    RE: Converting from Excel into a fixed length record

    you can use the LEFT function

    eg

    Sub testpad()
    MsgBox Pad("AB", 5) & "def"
    msgbox PAD(range("A1"),5)
    End Sub

    Function Pad(text As String, chrs As Long) As String
    Pad = Left(text & String(chrs, " "), 5)
    End Function

    "Gavin" wrote:

    > A simplified example of what I need to do.
    >
    > I have the following cells in Excel A1=xxx, A2=yyyyy and A3=zzzzz
    > which I need to convert in a fixed length record with offsets of 0, 5 & 13
    > so that it looks like this "xxx yyyyy zzzzz"
    >
    > If the field is a numeric I can use custom option to format the field to the
    > appropriate no. of characters but how do I do this for an alpha field ?


+ 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