Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create an ASCII Fixed Length File from Excel Laura Excel Discussion (Misc queries) 3 January 24th 08 09:56 PM
How do I export an Excel spreadsheet with fixed length rows? Paul from St.Paul Excel Discussion (Misc queries) 5 July 14th 05 04:55 AM
Exporting from Excel to a Fixed Length Flat File bearie Excel Worksheet Functions 4 June 16th 05 02:16 AM
Saving an EXCEL spreadsheet in fixed length format PrakashK Excel Programming 1 June 3rd 05 11:52 PM
fixed string length,even other record is copied viv Excel Discussion (Misc queries) 0 May 30th 05 08:28 PM


All times are GMT +1. The time now is 02:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"