converting csv text to rows instead of columns

krisso

Active Member
Joined
Sep 16, 2005
Messages
291
Is there a way when importing data from a csv file using the delemiter ; to seperate the data to get excel to put it into rows instead of columns?

The data I am trying to import will exceed the number of columns

Thanks

Chris
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Stormseed

Banned
Joined
Sep 18, 2006
Messages
3,274
Hi Chris,

AFAIK, Excel does not provide the option to convert "text to rows". Nevertheless you can still break up your data using "text to columns" into 256 columns (if you are using Excel 2003 and below), transpose as values, again into 256 columns and so on.

Besides, you can use this formula in order to move your text (assuming the csv text is in A1) into consecutive rows, copied down:

=MID(A$1,ROW(),1)

Hope this helps you :)
 

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
try
Code:
Sub test()
Dim fn As String, delim As String, temp As String, x
Dim i As Long, ii As Long, a() As String
fn = "c:\test.csv"    '<- file path
delim = ";"
temp = CreateObject("Scripting.FileSytemObject").OpenTextFile(fn).ReadAll
x = Split(temp, vbCrLf)
ReDim a(1 To 10000, 1 To UBound(x) + 1)
For i = 0 To UBound(x)
    y = Split(x(i), delim) 
    For ii = 0 To UBound(y) : a(ii + 1, i + 1) = y(ii) : Next
Next
ThisWorkbook.Sheets(1).Range("a1").Resize(10000, UBound(a,2)).Value = a
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,399
Messages
5,601,459
Members
414,451
Latest member
jrose7

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
Top