Find and Replace Text with CarriageReturn

R

RickT

I get a data extract that includes "\n" text. I would
like to replace with CarriageReturn using a macro. I
cannot seem to make the normal Find and Replace work for
this.
 
T

Trevor Shuttleworth

Rick

one way:

Cells.Replace _
What:="/n", _
Replacement:=Chr(10), _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False

Regards

Trevor
 
K

Kieran

RickT

Try

Sub ReplaceSlashN()
'
''
ActiveSheet.UsedRange.Replace What:="/n", Replacement:="" & Chr(10)
& "", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
End Sub
 
D

Dave Peterson

I was able to do it manually:

I selected the range and hit Edit|replace
find what: \n
replace with: hit and hold the altkey and type 0010 from the number
keypad--not above QWERTY.

It may look like nothing got entered, but try it anyway.
 

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

Top