Alt+Enter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
'-------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top