Automatic Replace with a RETURN (ALT-ENTER)

Herve

Board Regular
Joined
May 6, 2003
Messages
68
I would like to find a character and replace it automatically with a Return so as to format my cells.
I know I can manually enter a Return by using the ALT-ENTER combination but I don't know how to do that automatically (in Word, we can replace by ^p but this does not work in Excel).

Any suggestion would be appreciated.

Hervé Chain
Houston, TX
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I was able to do it in a quick macro (replacing d with a carriage return). Try on a copy first.


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

K
 
Upvote 0
We had a long string of data separated by semicolons in each cell. The user wanted the data to start on a new line after each semicolon. We searched for "; " and replaced it with "[control]-J". Success. :LOL:
 
Upvote 0
I was able to do it in a quick macro (replacing d with a carriage return). Try on a copy first.


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

K

I tried this on my file with 5000 rows and paragraphs within these with "GDT" to be replaced by a carriage return. But it stops after one thousand rows or so. Running the macro again doesn't make it continue where it left off.
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,239
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top