Microsoft KB Archive/78637

{| = Excel: Flat File Formats Noncontiguous Selections Vertically =
 * width="100%"|

Last reviewed: November 30, 1994

Article ID: Q78637 The information in this article applies to:
 * Microsoft Excel for Windows, versions 3.0, 4.0

SUMMARY
In Microsoft Excel, if you use the Flat File add-in macro to export a noncontiguous selection to a text file, each individual range is printed below the previous one, regardless of the relationship of the two ranges on the worksheet.

Note that in Microsoft Excel version 5.0, you can use the Text Import Wizard when you open a text file to control what data to import and how the data should be spread across columns.

MORE INFORMATION
Flat File (FLATFILE.XLA) allows you to export data from a worksheet to a text file. It will not preserve the relative positions of ranges to each other when you export a noncontiguous selection. For example, if the data that you are exporting includes the noncontiguous ranges A1:A4 and D1:D4, you might expect the resulting text file to consist of two columns of data. However, because Flat File treats each range in the non-contiguous selection separately, you will see a single column of data containing the values from both ranges in the resulting text file.

Note: The &quot;Microsoft Excel User's Guide&quot; version 3.0 states on page 684 that the export range you select must be a contiguous range. The &quot;Microsoft Excel User's Guide 2&quot; version 4.0 states on page 152 that the export range must be contiguous. This is incorrect. Flat File is able to export a noncontiguous selection.

Workaround
This behavior is by design. To work around this behavior, you must manipulate the ranges to export so that they are next to each other and select them as a contiguous range. In some cases, you can do this by hiding the columns or rows that you do not want to include in your export range, as the Flat File macro will only export what is displayed on the screen.