Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default delete extra lines within same cell

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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
To add extra line/lines to single cell in Excel spreadsheet Helen New Users to Excel 3 January 13th 08 11:23 PM
delete extra lines within same cell Bob Phillips Excel Programming 0 January 10th 07 06:16 PM
How do I delete an extra space in every cell in a column? iamjbunni Excel Discussion (Misc queries) 2 April 21st 06 06:14 PM
Macro for Excel to add up items and delete extra lines? Fiero84 Excel Programming 1 October 18th 05 03:01 PM
?? Extra blank lines in 'address' cell after exporting to Excel Hadyn Pkok Excel Discussion (Misc queries) 4 April 15th 05 11:34 PM


All times are GMT +1. The time now is 01:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"