Alt+Enter

M

Mandarina

I have lines of text in a number of cells which needs to start on a new line at a specific point. This can obviously be done manually by using Alt+Enter but there doesnt seem to be any way of automating this, i.e using find and replace. Does anyone have any ideas?
 
B

BrianB

Not sure exactly what you want, but this is the principle. It inserts
line break after the 5th. character of each cell :-

'-----------------------------------
Sub InsertBreak()
rw = 1
BreakPoint = 5
'--------------------
While ActiveSheet.Cells(rw, 1).Value <> ""
MyStr = ActiveSheet.Cells(rw, 1).Value
ActiveSheet.Cells(rw, 1).Value = Left(MyStr, BreakPoint) & Chr(10
_
& Mid(MyStr, BreakPoint + 1, 256)
rw = rw + 1
Wend
End Sub
'-------------------------------------
 
Top