如何删除Excel中的换行符

我有一个Excel表中的数据。 在该表中,为新行插入了手动中断。 我想删除所有新的行字符,并在一行中的一切。

我怎样才能做到这一点?

我试过select列和replace下查找文本框中,我按下ctrl + j和在replace,我进入了一个空间。 但是excel显示没有数据匹配replace。

请介绍如何删除excel文件中的手动中断?

如果用ALT-ENTER插入手动中断,那么这个小macros将用空格replace它们:

Sub qwerty() Cells.Replace Chr(10), " " End Sub 

一个快速和肮脏的方法是将文件保存为文本文件,然后使用一个实用工具,如grep或在word / wordpad / sublimetext / textmate中打开,并在EOL字符上进行全局replace

删除所有行断开,只留下一行。 select单元格或范围的单元格并运行macros。

 Sub RemoveLineBreaks() Application.ScreenUpdating = False Dim rngCell As Range Dim strOldVal As String Dim strNewVal As String For Each rngCell In Selection If rngCell.HasFormula = False Then strOldVal = rngCell.Value strNewVal = strOldVal Debug.Print rngCell.Address Do strNewVal = Replace(strNewVal, vbLf, " ") If strNewVal = strOldVal Then Exit Do strOldVal = strNewVal Loop If rngCell.Value <> strNewVal Then rngCell = strNewVal End If End If rngCell.Value = Application.Trim(rngCell.Value) Next rngCell Application.ScreenUpdating = True End Sub