Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a bunch of single line CSV files (without even new line characters on
the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Robin,
Put the code below into an otherwise blank workbook, then run the macro, and select the files that you want to combine when the file selection dialog appears. HTH, Bernie MS Excel MVP Sub ConsolidateMultipleUserSelectedFiles() Dim FileArray As Variant Dim myBook As Workbook Set myBook = ThisWorkbook FileArray = Application.GetOpenFilename(MultiSelect:=True) If IsArray(FileArray) Then For i = LBound(FileArray) To UBound(FileArray) Workbooks.OpenText Filename:=FileArray(i), Origin:= _ xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _ xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, _ Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(1, 1) Range("A1").CurrentRegion.Copy myBook.Worksheets(1).Range("a65536").End(xlUp).Off set(1, 0) ActiveWorkbook.Close False Next i End If myBook.Save End Sub "RobinC" wrote in message ... I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi RobinC
You can do it also without code if you want http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "RobinC" wrote in message ... I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Will the method outlined in Example 1 deal with putting each line onto a new
row (which is what I *guessed* the OP may have wanted)? -- David Biddulph "Ron de Bruin" wrote in message ... Hi RobinC You can do it also without code if you want http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "RobinC" wrote in message ... I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Yes if the data is one row in every csv file it is one row in Excel when you import the txt file
-- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "David Biddulph" <groups [at] biddulph.org.uk wrote in message ... Will the method outlined in Example 1 deal with putting each line onto a new row (which is what I *guessed* the OP may have wanted)? -- David Biddulph "Ron de Bruin" wrote in message ... Hi RobinC You can do it also without code if you want http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "RobinC" wrote in message ... I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Interesting!
When I tried it, the resulting file had no new line between the input csv files, and didn't even have a comma or anything, so the first field of the second file was concatenated with the last field of the first file, and so on, and when imported into Excel they were all on the same row.. I wonder what I'm doing different from your suggestion? -- David Biddulph "Ron de Bruin" wrote in message ... Yes if the data is one row in every csv file it is one row in Excel when you import the txt file -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "David Biddulph" <groups [at] biddulph.org.uk wrote in message ... Will the method outlined in Example 1 deal with putting each line onto a new row (which is what I *guessed* the OP may have wanted)? -- David Biddulph "Ron de Bruin" wrote in message ... Hi RobinC You can do it also without code if you want http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "RobinC" wrote in message ... I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi David
No problem here with a new test when I use the exact steps from my site I go to bed now but maybe Dave or ? can help you If not I reply tomorrow after work -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "David Biddulph" <groups [at] biddulph.org.uk wrote in message ... Interesting! When I tried it, the resulting file had no new line between the input csv files, and didn't even have a comma or anything, so the first field of the second file was concatenated with the last field of the first file, and so on, and when imported into Excel they were all on the same row.. I wonder what I'm doing different from your suggestion? -- David Biddulph "Ron de Bruin" wrote in message ... Yes if the data is one row in every csv file it is one row in Excel when you import the txt file -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "David Biddulph" <groups [at] biddulph.org.uk wrote in message ... Will the method outlined in Example 1 deal with putting each line onto a new row (which is what I *guessed* the OP may have wanted)? -- David Biddulph "Ron de Bruin" wrote in message ... Hi RobinC You can do it also without code if you want http://www.rondebruin.nl/csv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "RobinC" wrote in message ... I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Just a curiousity question...
If you open a single CSV file, do things get imported correctly. That lack of linefeed characters scares me. RobinC wrote: I have a bunch of single line CSV files (without even new line characters on the end) that I want to concatenate into a single file, which I then want to work with in excel. How can I do this? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
vlookup and concatenate multiple occurences | Excel Discussion (Misc queries) | |||
view multiple files in multiple windows on multiple screens. | Excel Discussion (Misc queries) | |||
Concatenate Multiple Cells | Excel Discussion (Misc queries) | |||
Concatenate multiple cells | Excel Discussion (Misc queries) | |||
How can I view files chronologically when opening multiple files | Excel Discussion (Misc queries) |