Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How about adding spaces as filler to make fields evenlength

If you need 15 char long values in CSV, you can add SPACEs as FILLER to your EXCEL Cell Value, then save it as CSV.

Unfortunately you have to loop through each row to make the changes. High level logic is like :-

For Each MyRow as ExcelRow in MySheet.Rows
MyRow(Col).Value &= " " 'u put 15 spaces
MyRow(Col).Value = MyRow(Col).Value.substring(0, 15)
Next

The above code will give you LEFT JUSTIFIED 15 char long CSV Field. If you want RIGHT JUSTIFIED Text in CSV, then CODE will be like (for the filler only)

MyRow(Col).Value = MyRow(Col).Value.Reverse()
MyRow(Col).Value &= " "
MyRow(Col).Value = MyRow(Col).Value.substring(0, 15)
MyRow(Col).Value = MyRow(Col).Value.Reverse()

Looping and string operation will take toll on performance - depending on how many rows you have and computer's power. Thnaks you.
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
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
how do i format a cell based on format of a range of cells? Chris Hardick Excel Discussion (Misc queries) 2 April 3rd 06 08:54 AM
How do I copy data in single cell format to a merged cell format Paul Excel Discussion (Misc queries) 1 June 27th 05 11:00 AM


All times are GMT +1. The time now is 06:36 AM.

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

About Us

"It's about Microsoft Excel"