ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CRLF in .cvs file (https://www.excelbanter.com/excel-programming/358286-crlf-cvs-file.html)

LMI

CRLF in .cvs file
 
I have an export format coming over from my hand help device that is coming
over in .csv when i open it up in excel my format is as follows:
date,time,value,shift
date, time,value,shift
date,time,value,shift
date,time value shift

How i need it to come over is this way:
date,time,value,shift[]date,time,value,shift[],date,time,value,shift.......

The[]is the CRLF how can i set the above format up running an excel macro?

Bernie Deitrick

CRLF in .cvs file
 
LMI,

You could use a macro: Select the cells, and run this.

Sub CombineMacro()
Dim myCell As Range
Dim myVal As String

Selection.EntireColumn.AutoFit

myVal = Selection.Cells(1).Value

For Each myCell In Selection.Offset(1).Resize(Selection.Rows.Count - 1)
myVal = myVal & Chr(10) & myCell.Value
Next myCell

Selection.ClearContents
Selection.Cells(1).Value = myVal
Selection.Cells(1).WrapText = True

End Sub

HTH,
Bernie
MS Excel MVP


"LMI" wrote in message
...
I have an export format coming over from my hand help device that is coming
over in .csv when i open it up in excel my format is as follows:
date,time,value,shift
date, time,value,shift
date,time,value,shift
date,time value shift

How i need it to come over is this way:
date,time,value,shift[]date,time,value,shift[],date,time,value,shift.......

The[]is the CRLF how can i set the above format up running an excel macro?




LMI

CRLF in .cvs file
 
"4/5/2006
4/5/2006
0.475509259259259
18952
7.86072
7.86072
7.86072
7.86072
4/5/2006
0.475543981481481
18952
7.86072
7.86072
7.86072
7.86072",
,
,

This works real good but how can i get the " and the extra ,, at te end off
the file?
Also how do i get my date 5 values and then have a CRLF then data again 5
values and CRLF ???




"Bernie Deitrick" wrote:

LMI,

You could use a macro: Select the cells, and run this.

Sub CombineMacro()
Dim myCell As Range
Dim myVal As String

Selection.EntireColumn.AutoFit

myVal = Selection.Cells(1).Value

For Each myCell In Selection.Offset(1).Resize(Selection.Rows.Count - 1)
myVal = myVal & Chr(10) & myCell.Value
Next myCell

Selection.ClearContents
Selection.Cells(1).Value = myVal
Selection.Cells(1).WrapText = True

End Sub

HTH,
Bernie
MS Excel MVP


"LMI" wrote in message
...
I have an export format coming over from my hand help device that is coming
over in .csv when i open it up in excel my format is as follows:
date,time,value,shift
date, time,value,shift
date,time,value,shift
date,time value shift

How i need it to come over is this way:
date,time,value,shift[]date,time,value,shift[],date,time,value,shift.......

The[]is the CRLF how can i set the above format up running an excel macro?






All times are GMT +1. The time now is 09:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com