Frank,
Either from the worksheet :
=GetFirstLineOnly(A1)
or in VBA
Range("A1").Value=GetFirstLineOnly(Range("A1").Val ue)
Public Function GetFirstLineOnly(argText As String) As String
If InStr(1, argText, vbLf) 0 Then
GetFirstLineOnly = Trim(Split(argText, vbLf)(0))
Else
GetFirstLineOnly = argText
End If
End Function
NickHK
"FrankM" wrote in message
...
This seems kindda odd to me but please stay with me.
I have been given a spreadsheet I need to work with. One column has cells
with multiple lines in the cell. Each line is separated by a carriage
return.
Sometimes there is three or four lines and sometimes there is five or six
lines, all within the same cell. Some cells are empty or have just one
line.
I would like to eliminate everything after the first carriage return so
each
cell has a maximum of one line.
I thought maybe this could be done in a Macro or in VB but I'm not
certain.
Any ideas?