在Excel中的单元格内要将已有的字符替换为换行符,在其“查找/替换”对话框中不能直接输入,而且也不能简单地像Word中用^p或者^13。目前找到一个能够解决的办法是,使用VBS的查找/替换语句,Chr(10)对应换行字符。代码如下:
Sub Replace_With_LineFeed() Dim rng As Range Set rng = Range("A1:" & Range("A65536") _ .End(xlUp).Address) For Each cell In rng cell.Select ActiveCell.Replace What:="", Replacement:=Chr(10), _ LookAt:=xlPart, SearchOrder:=xlByRows, _ MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Next End Sub
从我查阅的资料了解更多请。