Replace with Carriage Return Not Working

redhots4

Board Regular
Joined
Aug 30, 2004
Messages
136
Office Version
  1. 365
Platform
  1. MacOS
I'm on a Mac with Microsoft 365 / Excel for Mac.

In the Replace dialogue, I'm using '$#@' as the Find Value and CTRL+OPT+RETURN as the Replace value. The replace runs but $#@ is replaced with a space, not a carriage return as expected. I've searched high and low for alternatives to a carriage return but none of them are working. Is there a way to put CHAR(13) into the Replace value field? If I enter CHAR(13) in that field, Excel literally replaces '$#@' with 'CHAR(13)'.

Any ideas?

I'm able to successfully do this replace on a Windows PC, but Mac is my primary machine so I want to figure this out. Thanks in advance!
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Not sure if this works on a Mac, but try using Ctrl J in the replace box
 
Upvote 0
Ok how about using Alt 010 but you need to use the numeric keypad.
 
Upvote 0
Are you sure you want Char(13) ? Not sure if you picked up on Fluff's last suggestion but Ctrl+J which is the same as windows Alt+Enter is actually Char(10) and is a Line Feed character.
I noticed that you have used VBA in the past so how about:
VBA Code:
Sub ReplaceWithCarriageReturn()
    ActiveSheet.UsedRange.Replace What:="$#@", Replacement:=ChrW(10), LookAt:=xlPart
End Sub
You should be able to use vbLf instead of ChrW(10) if you want to.
 
Upvote 0
Are you sure you want Char(13) ? Not sure if you picked up on Fluff's last suggestion but Ctrl+J which is the same as windows Alt+Enter is actually Char(10) and is a Line Feed character.
I noticed that you have used VBA in the past so how about:
VBA Code:
Sub ReplaceWithCarriageReturn()
    ActiveSheet.UsedRange.Replace What:="$#@", Replacement:=ChrW(10), LookAt:=xlPart
End Sub
You should be able to use vbLf instead of ChrW(10) if you want to.
Thanks for the suggestion, I will try this. Any ideas on how to do this within the Replace dialog itself?
 
Upvote 0
Unfortunately unless the Alt 010 method that Fluff suggested in post #4 works on a Mac, I was unable to find any posts providing an alternative for a Mac. (I am on a windows laptop)
 
Upvote 0

Forum statistics

Threads
1,215,124
Messages
6,123,187
Members
449,090
Latest member
bes000

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