Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an Excel worksheet with 24 fields which I need to create a flat file
to be read by another application. I need to fill any unused spaces in a field with spaces so that when I have a field defined as five characters in length, but the data in the worksheet has variable length data. I need to pad the rest with blanks. This ensures that that a certain field starts in a required column and is a certain length long. example: Last_Name 53,20, the last name field begins in column 53 and is 20 characters in length. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way is to define the fields with their specfied lengths and then assign
data as per example below. If data is longer than field, it is truncated. Sub fixedFields() Dim field As String * 8 ' length of 8 field = "ABC" MsgBox Len(field) & " " & field End Sub HTH "TTewell" wrote: I have an Excel worksheet with 24 fields which I need to create a flat file to be read by another application. I need to fill any unused spaces in a field with spaces so that when I have a field defined as five characters in length, but the data in the worksheet has variable length data. I need to pad the rest with blanks. This ensures that that a certain field starts in a required column and is a certain length long. example: Last_Name 53,20, the last name field begins in column 53 and is 20 characters in length. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Filling formulas with specific cell references remaining the same | Excel Worksheet Functions | |||
Quantity Blank, Remaining cells in row appear Blank | Excel Worksheet Functions | |||
FILLING A RANGE WITH SAME CHARACTERS INVOLVING HIDDED ROWS | Excel Discussion (Misc queries) | |||
Filling cells with Word text characters | Excel Discussion (Misc queries) | |||
Removing blank characters from left of field | Excel Programming |