Saving from excel to fixed width file

pmsteph

New Member
Joined
Oct 17, 2003
Messages
33
I need to save/copy data I have set up in Excel into a fixed width file for importing into a database.

Is this possible & how do I set it up so the columns are the correct widths?

Any help would be useful.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
We could certainly automate this with VBA; and perhaps someone with time to do it will stop by. But in the meantime, here's a simply way to get you going.
  1. Create a row with your required widths. (Row 1 in my example.)
  2. Create a formula that concatenates the columns together, using the LEN() and REPT() functions to pad appropriately.
  3. Then you can copy the contents of your composite column over to NOTEPAD, paste in and save and your done.
book1
ABCDEF
15101081Composite
2aaBBBBBCCCCCCCDDDDDDZaa BBBBB CCCCCCC DDDDDD Z
3aBBCCCCCDZa BB CCCCC D Z
4AAAAbbbbbbbCcCcddddZAAAA bbbbbbb CcCc dddd Z
Sheet1


Formula in F2 and downwards: <ul>[*]=A2&REPT(" ",A$1-LEN(A2))&B2&REPT(" ",B$1-LEN(B2))&C2&REPT(" ",C$1-LEN(C2))&D2&REPT(" ",D$1-LEN(D2))&E2&REPT(" ",E$1-LEN(E2))[/list]

HTH
 
Upvote 0
OK - this does actually work -- the problem is that the PHP software of this board strips out double spaces. So don't worry that column F doesn't look right in the posted example.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,702
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top